count_if

The function count_if is used to find the number of elements that match the criteria.

  template <class InputIterator, class Predicate>
  typename iterator_traits
  <InputIterator>::difference_type count_if
  (InputIterator first, InputIterator last,Predicate pred);
  
Remarks

Returns the number of elements (iterators) as an iterator_traits<InputIterator>::difference_type