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`` 11template<class ForwardRange> 12typename range_return<ForwardRange, return_begin_found>::type 13unique(ForwardRange& rng); 14 15template<class ForwardRange> 16typename range_return<const ForwardRange, return_begin_found>::type 17unique(const ForwardRange& rng); 18 19template<class ForwardRange, class BinaryPredicate> 20typename range_return<ForwardRange, return_begin_found>::type 21unique(ForwardRange& rng, BinaryPredicate pred); 22 23template<class ForwardRange, class BinaryPredicate> 24typename range_return<const ForwardRange, return_begin_found>::type 25unique(const ForwardRange& rng, BinaryPredicate pred); 26 27template<range_return_value re, class ForwardRange> 28typename range_return<ForwardRange, re>::type 29unique(ForwardRange& rng); 30 31template<range_return_value re, class ForwardRange> 32typename range_return<const ForwardRange, re>::type 33unique(const ForwardRange& rng); 34 35template<range_return_value re, class ForwardRange, class BinaryPredicate> 36typename range_return<ForwardRange, re>::type 37unique(ForwardRange& rng, BinaryPredicate pred); 38 39template<range_return_value re, class ForwardRange, class BinaryPredicate> 40typename range_return<const ForwardRange, re>::type 41unique(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 48Elements in the range `[new_last, end(rng))` are dereferenceable but undefined. 49 50Equality is determined by the predicate if one is supplied, or by `operator==()` for `ForwardRange`'s value type. 51 52[heading Definition] 53 54Defined 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 73Linear. `O(N)` where `N` is `distance(rng)`. Exactly `distance(rng)` comparisons are performed. 74 75[endsect] 76 77 78