Hello,
Suppose I have a container of pair<int, int>, how would I use the
predefined function objects/adapters (e.g., greater, bind1st, mem_func,
compose_f_gx) and the "count" function from <algorithmto get and
number of pairs, "p", that have "p.first 5"?
Writing a custom UnaryPredicate function is easy, but I would
prefer to use the predefined ones if possible.
Example:
std::list<std::pair<int, int c;
// insert elements in c
int x = count(c.begin(), c.end(), /* UnaryPredicate */);
// x is the number of pairs, p, with p.first 5
More general, how can I compose the predefined function
objects/adapters, so that the resulting UnaryPredicate peeks inside the
elements of a container?
Thanks,
Rares