]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/doc/reference/algorithm/unique.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / range / doc / reference / algorithm / unique.qbk
1 [/
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)
5 /]
6 [section:unique unique]
7
8 [heading Prototype]
9
10 ``
11 template<class ForwardRange>
12 typename range_return<ForwardRange, return_begin_found>::type
13 unique(ForwardRange& rng);
14
15 template<class ForwardRange>
16 typename range_return<const ForwardRange, return_begin_found>::type
17 unique(const ForwardRange& rng);
18
19 template<class ForwardRange, class BinaryPredicate>
20 typename range_return<ForwardRange, return_begin_found>::type
21 unique(ForwardRange& rng, BinaryPredicate pred);
22
23 template<class ForwardRange, class BinaryPredicate>
24 typename range_return<const ForwardRange, return_begin_found>::type
25 unique(const ForwardRange& rng, BinaryPredicate pred);
26
27 template<range_return_value re, class ForwardRange>
28 typename range_return<ForwardRange, re>::type
29 unique(ForwardRange& rng);
30
31 template<range_return_value re, class ForwardRange>
32 typename range_return<const ForwardRange, re>::type
33 unique(const ForwardRange& rng);
34
35 template<range_return_value re, class ForwardRange, class BinaryPredicate>
36 typename range_return<ForwardRange, re>::type
37 unique(ForwardRange& rng, BinaryPredicate pred);
38
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);
42 ``
43
44 [heading Description]
45
46 `unique` removes all but the first element of each sequence of duplicate encountered in `rng`.
47
48 Elements in the range `[new_last, end(rng))` are dereferenceable but undefined.
49
50 Equality is determined by the predicate if one is supplied, or by `operator==()` for `ForwardRange`'s value type.
51
52 [heading Definition]
53
54 Defined in the header file `boost/range/algorithm/unique.hpp`
55
56 [heading Requirements]
57
58 [*For the non-predicate versions of unique:]
59
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`.
63
64 [*For the predicate versions of unique:]
65
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.
70
71 [heading Complexity]
72
73 Linear. `O(N)` where `N` is `distance(rng)`. Exactly `distance(rng)` comparisons are performed.
74
75 [endsect]
76
77