Name

search_n function template — Searches a range for a repeated value

Synopsis

template<typename FwdIter, typename Size, typename T>
  FwdIter search_n(FwdIter first, FwdIter last, Size count, const T& value);
template<typename FwdIter, typename Size, typename T, typename BinaryPredicate>
  FwdIter search_n(FwdIter first, FwdIter last, Size count, const T& value,
                   BinaryPredicate pred);

The search_n function template finds the first (leftmost) subsequence of count adjacent occurrences of value in the range [first, last). It returns an iterator that points to the start of the subsequence or last if the subsequence is not found.

The first form compares items with the == operator. The second form calls pred(*iter, value).