
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ř.