Created on 2000-03-06.00:00:00 last changed 172 months ago
Rationale:
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".
Proposed resolution:
In section [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.
to:
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.
[ 2009-07 Frankfurt ]
The same thing can be achieved using find_if (as noted in the issue).
Moved to NAD.
[ Summit: ]
Reopened by Alisdair.
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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg1892 |
2010-10-21 18:28:33 | admin | set | messages: + msg1891 |
2010-10-21 18:28:33 | admin | set | messages: + msg1890 |
2010-10-21 18:28:33 | admin | set | messages: + msg1889 |
2000-03-06 00:00:00 | admin | create |