| <<< std::count_if and predicate function | Index | >>> |
class less_than {
public:
less_than( int t )
: m_thresh( t )
{
}
bool operator( )( int v )
{
return v < m_thresh;
}
private:
int m_thresh;
};//class less_than
vector< int > v1;
int x = 14;
int count_less = std::count_if( v1.begin(), v1.end(), less_than( x ) );
| <<< std::count_if and predicate function | Index | >>> |