25 Algorithms library [algorithms]

25.3 Non-modifying sequence operations [alg.nonmodifying]

25.3.9 Count [alg.count]

template<class InputIterator, class T> typename iterator_traits<InputIterator>::difference_type count(InputIterator first, InputIterator last, const T& value); template<class ExecutionPolicy, class InputIterator, class T> typename iterator_traits<InputIterator>::difference_type count(ExecutionPolicy&& exec, InputIterator first, InputIterator last, const T& value); template<class InputIterator, class Predicate> typename iterator_traits<InputIterator>::difference_type count_if(InputIterator first, InputIterator last, Predicate pred); template<class ExecutionPolicy, class InputIterator, class Predicate> typename iterator_traits<InputIterator>::difference_type count_if(ExecutionPolicy&& exec, InputIterator first, InputIterator last, Predicate pred);

Effects: Returns the number of iterators i in the range [first, last) for which the following corresponding conditions hold: *i == value, pred(*i) != false.

Complexity: Exactly last - first applications of the corresponding predicate.