2 Copyright 2010 Neil Groves
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 [section:equal_range equal_range]
15 std::pair<typename range_iterator<ForwardRange>::type,
16 typename range_iterator<ForwardRange>::type>
17 equal_range(ForwardRange& rng, const Value& val);
23 std::pair<typename range_iterator<const ForwardRange>::type,
24 typename range_iterator<const ForwardRange>::type>
25 equal_range(const ForwardRange& rng, const Value& val);
32 std::pair<typename range_iterator<ForwardRange>::type,
33 typename range_iterator<ForwardRange>::type>
34 equal_range(ForwardRange& rng, const Value& val, SortPredicate pred);
41 std::pair<typename range_iterator<const ForwardRange>::type,
42 typename range_iterator<const ForwardRange>::type>
43 equal_range(const ForwardRange& rng, const Value& val, SortPredicate pred);
48 `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<`.
49 For the predicate versions of `equal_range` the equality of elements is determined by `pred`.
53 Defined in the header file `boost/range/algorithm/equal_range.hpp`
55 [heading Requirements]
57 [*For the non-predicate versions:]
59 * `ForwardRange` is a model of the __forward_range__ Concept.
60 * `Value` is a model of the `LessThanComparableConcept`.
61 * The ordering of objects of type `Value` is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
62 * `ForwardRange`'s value type is the same type as `Value`.
64 [*For the predicate versions:]
66 * `ForwardRange` is a model of the __forward_range__ Concept.
67 * `SortPredicate` is a model of the `StrictWeakOrderingConcept`.
68 * `ForwardRange`'s value type is the same as `Value`.
69 * `ForwardRange`'s value type is convertible to both of `SortPredicate`'s argument types.
71 [heading Precondition:]
73 For the non-predicate versions: `rng` is ordered in ascending order according to `operator<`.
75 For the predicate versions: `rng` is ordered in ascending order according to `pred`.
79 For random-access ranges, the complexity is `O(log N)`, otherwise the complexity is `O(N)`.