count
count
template<class InIt, class T>
size_t count(InIt first, InIt last,
const T& val);
The template function sets a count n
to zero. It then executes ++n
for each N
in the range [0, last - first)
for which the predicate *(first + N) == val
is true. The function returns n
. It evaluates the predicate exactly last - first
times.
In this implementation, if a translator does not support partial specialization of templates, the return type is size_t
instead of iterator_traits<InIt>::distance_type
.
See the related sample program.