Home | Libraries | People | FAQ | More |
template< class ForwardRange, class Value > std::pair<typename range_iterator<ForwardRange>::type, typename range_iterator<ForwardRange>::type> equal_range(ForwardRange& rng, const Value& val); template< class ForwardRange, class Value > std::pair<typename range_iterator<const ForwardRange>::type, typename range_iterator<const ForwardRange>::type> equal_range(const ForwardRange& rng, const Value& val); template< class ForwardRange, class Value, class SortPredicate > std::pair<typename range_iterator<ForwardRange>::type, typename range_iterator<ForwardRange>::type> equal_range(ForwardRange& rng, const Value& val, SortPredicate pred); template< class ForwardRange, class Value, class SortPredicate > std::pair<typename range_iterator<const ForwardRange>::type, typename range_iterator<const ForwardRange>::type> equal_range(const ForwardRange& rng, const Value& val, SortPredicate pred);
equal_range
returns a
range in the form of a pair of iterators where all of the elements are
equal to val
. If no values
are found that are equal to val
,
then an empty range is returned, hence result.first == result.second
.
For the non-predicate versions of equal_range
the equality of elements is determined by operator<
. For the predicate versions of equal_range
the equality of elements
is determined by pred
.
Defined in the header file boost/range/algorithm/equal_range.hpp
For the non-predicate versions:
ForwardRange
is a
model of the Forward
Range Concept.
Value
is a model
of the LessThanComparableConcept
.
Value
is a strict weak ordering,
as defined in the LessThanComparableConcept
requirements.
ForwardRange
's value
type is the same type as Value
.
For the predicate versions:
ForwardRange
is a
model of the Forward
Range Concept.
SortPredicate
is
a model of the StrictWeakOrderingConcept
.
ForwardRange
's value
type is the same as Value
.
ForwardRange
's value
type is convertible to both of SortPredicate
's
argument types.
For the non-predicate versions: rng
is ordered in ascending order according to operator<
.
For the predicate versions: rng
is ordered in ascending order according to pred
.
For random-access ranges, the complexity is O(log N)
,
otherwise the complexity is O(N)
.