Search for Ranges within Ranges

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

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

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

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

Get hands-on with 1000+ tech skills courses.