Search Ranges

Need to acquire a sub-range from any existing range? std::search solves the problem efficiently.

std::search Searches for a range in another range from the beginning.
std::find_end Searches for a range in another range from the end.
std::search_n Searches for n consecutive elements in the range.

All algorithms that take a forward iterator can be parametrized by a binary predicate and return an end iterator for the first range, if the search was not successful.

Searches the values of the second range in the first range and returns the position. Starts at the beginning:

Get hands-on with 1400+ tech skills courses.