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:unique unique]
11 template<class ForwardRange>
12 typename range_return<ForwardRange, return_begin_found>::type
13 unique(ForwardRange& rng);
15 template<class ForwardRange>
16 typename range_return<const ForwardRange, return_begin_found>::type
17 unique(const ForwardRange& rng);
19 template<class ForwardRange, class BinaryPredicate>
20 typename range_return<ForwardRange, return_begin_found>::type
21 unique(ForwardRange& rng, BinaryPredicate pred);
23 template<class ForwardRange, class BinaryPredicate>
24 typename range_return<const ForwardRange, return_begin_found>::type
25 unique(const ForwardRange& rng, BinaryPredicate pred);
27 template<range_return_value re, class ForwardRange>
28 typename range_return<ForwardRange, re>::type
29 unique(ForwardRange& rng);
31 template<range_return_value re, class ForwardRange>
32 typename range_return<const ForwardRange, re>::type
33 unique(const ForwardRange& rng);
35 template<range_return_value re, class ForwardRange, class BinaryPredicate>
36 typename range_return<ForwardRange, re>::type
37 unique(ForwardRange& rng, BinaryPredicate pred);
39 template<range_return_value re, class ForwardRange, class BinaryPredicate>
40 typename range_return<const ForwardRange, re>::type
41 unique(const ForwardRange& rng, BinaryPredicate pred);
46 `unique` removes all but the first element of each sequence of duplicate encountered in `rng`.
48 Elements in the range `[new_last, end(rng))` are dereferenceable but undefined.
50 Equality is determined by the predicate if one is supplied, or by `operator==()` for `ForwardRange`'s value type.
54 Defined in the header file `boost/range/algorithm/unique.hpp`
56 [heading Requirements]
58 [*For the non-predicate versions of unique:]
60 * `ForwardRange` is a model of the __forward_range__ Concept.
61 * `ForwardRange` is mutable.
62 * `ForwardRange`'s value type is a model of the `EqualityComparableConcept`.
64 [*For the predicate versions of unique:]
66 * `ForwardRange` is a model of the __forward_range__ Concept.
67 * `ForwardRange` is mutable.
68 * `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
69 * `ForwardRange`'s value type is convertible to `BinaryPredicate`'s first argument type and to `BinaryPredicate`'s second argument type.
73 Linear. `O(N)` where `N` is `distance(rng)`. Exactly `distance(rng)` comparisons are performed.