Section: 26.6.9 [alg.find.first.of] Status: CD1 Submitter: Doug Gregor Opened: 2006-04-25 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [alg.find.first.of].
View all issues with CD1 status.
Discussion:
In 25.1.4 Find First [lib.alg.find.first], the two iterator type parameters to find_first_of are specified to require Forward Iterators, as follows:
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);
However, ForwardIterator1 need not actually be a Forward Iterator; an Input Iterator suffices, because we do not need the multi-pass property of the Forward Iterator or a true reference.
Proposed resolution:
Change the declarations of find_first_of
to:
template<classForwardIterator1InputIterator1, class ForwardIterator2>ForwardIterator1InputIterator1 find_first_of(ForwardIterator1InputIterator1 first1,ForwardIterator1InputIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template<classForwardIterator1InputIterator1, class ForwardIterator2, class BinaryPredicate>ForwardIterator1InputIterator1 find_first_of(ForwardIterator1InputIterator1 first1,ForwardIterator1InputIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);