Created on 2007-08-30.00:00:00 last changed 172 months ago
Proposed resolution:
Change the complexity to "At most (last - first) applications of the corresponding predicate".
template<class ForwardIterator, class Size, class T> ForwardIterator search_n(ForwardIterator first , ForwardIterator last , Size count , const T& value ); template<class ForwardIterator, class Size, class T, class BinaryPredicate> ForwardIterator search_n(ForwardIterator first , ForwardIterator last , Size count , const T& value , BinaryPredicate pred );Complexity: At most (last - first )
* countapplications of the corresponding predicateif count is positive, or 0 otherwise.
The complexity for search_n ([alg.search] par 7) is specified as "At most (last - first ) * count applications of the corresponding predicate if count is positive, or 0 otherwise." This is unnecessarily pessimistic. Regardless of the value of count, there is no reason to examine any element in the range more than once.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg3519 |
2007-08-30 00:00:00 | admin | create |