Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofCD1 status.

576. find_first_of is overconstrained

Section: 26.6.9[alg.find.first.of]Status:CD1Submitter: Doug GregorOpened: 2006-04-25Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [alg.find.first.of].

View all issues withCD1 status.

Discussion:

In 25.1.4 Find First [lib.alg.find.first], the two iterator type parameters tofind_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 InputIterator suffices, because we do not need the multi-pass property of the ForwardIterator or a true reference.

Proposed resolution:

Change the declarations offind_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);

[8]ページ先頭

©2009-2026 Movatter.jp