search_n [C++ Reference]
Keywords: stl,algorithm,search_n
Date: 2009-10-09T01:05:42-0700

## search_n

Syntax:

        #include <algorithm>
        forward_iterator search_n( forward_iterator start, forward_iterator end, SIZE num, const TYPE& val );
        forward_iterator search_n( forward_iterator start, forward_iterator end, SIZE 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