count_if()
Returns a count of the number of times the operator evaluated as true.
#include <algorithm>
class Even {
public:
bool operator()( int val ){ return !( val%2 ); }
};
ires = count_if( ia, ia+8, bind2nd(less<int>(),10) );
lres = count_if( ilist.begin(), ilist_end(), Even() );
|