|
Boost : |
Subject: [boost] [Probing interest] -- automatization of writing predicates.
From: Petr PilaÅ (email_at_[hidden])
Date: 2010-11-18 08:27:03
Hi folks,
I often find myself in a situation where I need a simple comparison predicate
for filtering, look-up, etc. Writing such predicates can get tedious over time
and adds unnecessary "bloat", especially when you use the predicate only once.
For that reason I have automated this process and I'm interested whether
others might find it useful as well.
Usage example:
auto_predicate(&ClassName::getter, compareWithMe) -- this returns functor
which compares the returned value with compareWithMe using == operator.
auto_predicate(&ClassName::getter, compareWithMe, comparator) -- this returns
functor which compares the returned value with compareWithMe using the given
comparator. (Note: getter return type does not have to match compareWithMe
type have you supplied comparator with proper signature.)
Best regards,
Petr PilaÅ.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk