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_copy unique_copy]
11 template<class SinglePassRange, class OutputIterator>
12 OutputIterator unique_copy(const SinglePassRange& rng, OutputIterator out);
14 template<class SinglePassRange, class OutputIterator, class BinaryPredicate>
15 OutputIterator unique_copy(const SinglePassRange& rng, OutputIterator out, BinaryPredicate pred);
20 `unique_copy` copies the first element of each sequence of duplicates encountered in `rng` to `out`.
22 Equality is determined by the predicate if one is supplied, or by `operator==()` for `SinglePassRange`'s value type.
26 Defined in the header file `boost/range/algorithm/unique_copy.hpp`
28 [heading Requirements]
30 [*For the non-predicate versions of unique:]
32 * `SinglePassRange` is a model of the __single_pass_range__ Concept.
33 * `SinglePassRange` is mutable.
34 * `SinglePassRange`'s value type is a model of the `EqualityComparableConcept`.
35 * `OutputIterator` is a model of the `OutputIteratorConcept`.
37 [*For the predicate versions of unique:]
39 * `SinglePassRange` is a model of the __single_pass_range__ Concept.
40 * `SinglePassRange` is mutable.
41 * `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
42 * `SinglePassRange`'s value type is convertible to `BinaryPredicate`'s first argument type and to `BinaryPredicate`'s second argument type.
43 * `OutputIterator` is a model of the `OutputIteratorConcept`.
47 Linear. `O(N)` where `N` is `distance(rng)`. Exactly `distance(rng)` comparisons are performed.