search_n()
search_n() looks for the first occurrence of n instances of a value within a sequence. In the following example, we search str for two occurrences of the character o in succession, and an iterator to the first o of moose is returned. If the subsequence is not present, an iterator that addresses the end of the first sequence is returned. An optional fifth parameter allows the user to override the default equality operator.
#include <algorithm>
const char oh = 'o';
char str[ 26 ] = "oh my a mouse ate a moose";
char *found_str = search_n( str, str+26, 2, oh );
|