std::less_equal is an STL predicate to perform operator<= on two values.
#include <algorithm> #include <cassert> #include <functional> #include <vector> int main() { //Create a std::vector with values {0,1,2,3,4,5} std::vector<int> v; for (int i = 0; i!=6; ++i) v.push_back(i); //Count the values less or equal to two const int n = std::count_if( v.begin(),v.end(), std::bind2nd(std::less_equal<int>(),2)); //Assume there are three values less or equal to two assert(n==3); }