stl:algorithm:search_n

C++ Reference

search_n

Syntax:

    #include <algorithm>
    iterator search_n( iterator start, iterator end, size_t num, const TYPE& val );
    iterator search_n( iterator start, iterator end, size_t num, const TYPE& val, BinPred p );

The search_n() function looks for num occurances of val in the range [start,end).

If num consecutive copies of val are found, search_n() returns an iterator to the beginning of that sequence. Otherwise it returns an iterator to end.

If the optional binary predicate p is given, then it is used to perform comparisons between elements.

This function runs in linear time.

Related Topics: find_end, find_if, search