Section: 28.5.5 [alg.find] Status: NAD Submitter: Pablo Halpern Opened: 2000-03-06 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [alg.find].
View all issues with NAD status.
The find function always searches for a value using operator== to compare the value argument to each element in the input iterator range. This is inconsistent with other find-related functions such as find_end and find_first_of, which allow the caller to specify a binary predicate object to be used for determining equality. The fact that this can be accomplished using a combination of find_if and bind_1st or bind_2nd does not negate the desirability of a consistent, simple, alternative interface to find.
[ Summit: ]
Reopened by Alisdair.
[ 2009-07 Frankfurt ]
The same thing can be achieved using find_if (as noted in the issue).
Moved to NAD.
In section 28.5.5 [alg.find], add a second prototype for find (between the existing prototype and the prototype for find_if), as follows:template<class InputIterator, class T, class BinaryPredicate> InputIterator find(InputIterator first, InputIterator last, const T& value, BinaryPredicate bin_pred);
Change the description of the return from:
Returns: The first iterator i in the range [first, last) for which the following corresponding conditions hold: *i == value, pred(*i) != false. Returns last if no such iterator is found.
Returns: The first iterator i in the range [first, last) for which the following corresponding condition holds: *i == value, bin_pred(*i,value) != false, pred(*) != false. Return last if no such iterator is found.
This is request for a pure extension, so it is not a defect in the current standard. As the submitter pointed out, "this can be accomplished using a combination of find_if and bind_1st or bind_2nd".