Difference between std::search and std::find_first_of

c++, find, std

Solution

The difference is that `std::search` searches for a whole range of elements within another range, while `std::find_first_of` searches for a single element from a range within another range.

Problem

I am trying to grasp the difference between `std::search` and `std::find_first_of` They have the same prototypes: ``` template <class ForwardIterator1, class ForwardIterator2> ForwardIterator1 find_first_of (ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> ForwardIterator1 find_first_of (ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); template <class ForwardIterator1, class ForwardIterator2> ForwardIterator1 search (ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> ForwardIterator1 search (ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); ``` They both return the same thing: An iterator to the first occurrence of the sequence [first2, last2) inside [first1, last1). (using equality, or a binary predicate) So what is the difference ? Am I wrong ?

Original source