Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 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_copy unique_copy] |
| 7 | |
| 8 | [heading Prototype] |
| 9 | |
| 10 | `` |
| 11 | template<class SinglePassRange, class OutputIterator> |
| 12 | OutputIterator unique_copy(const SinglePassRange& rng, OutputIterator out); |
| 13 | |
| 14 | template<class SinglePassRange, class OutputIterator, class BinaryPredicate> |
| 15 | OutputIterator unique_copy(const SinglePassRange& rng, OutputIterator out, BinaryPredicate pred); |
| 16 | `` |
| 17 | |
| 18 | [heading Description] |
| 19 | |
| 20 | `unique_copy` copies the first element of each sequence of duplicates encountered in `rng` to `out`. |
| 21 | |
| 22 | Equality is determined by the predicate if one is supplied, or by `operator==()` for `SinglePassRange`'s value type. |
| 23 | |
| 24 | [heading Definition] |
| 25 | |
| 26 | Defined in the header file `boost/range/algorithm/unique_copy.hpp` |
| 27 | |
| 28 | [heading Requirements] |
| 29 | |
| 30 | [*For the non-predicate versions of unique:] |
| 31 | |
| 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`. |
| 36 | |
| 37 | [*For the predicate versions of unique:] |
| 38 | |
| 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`. |
| 44 | |
| 45 | [heading Complexity] |
| 46 | |
| 47 | Linear. `O(N)` where `N` is `distance(rng)`. Exactly `distance(rng)` comparisons are performed. |
| 48 | |
| 49 | [endsect] |