Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
count_if
Prototype

template<class SinglePassRange, class UnaryPredicate>
typename range_difference<const SinglePassRange>::type
count_if(const SinglePassRange& rng, UnaryPredicate pred);

Description

count_if returns the number of elements x in rng where pred(x) is true.

Definition

Defined in the header file boost/range/algorithm/count_if.hpp

Requirements
Complexity

Linear. Exactly distance(rng) invocations of pred.


PrevUpHomeNext