Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
unique_copy
Prototype

template<class SinglePassRange, class OutputIterator>
OutputIterator unique_copy(const SinglePassRange& rng, OutputIterator out);

template<class SinglePassRange, class OutputIterator, class BinaryPredicate>
OutputIterator unique_copy(const SinglePassRange& rng, OutputIterator out, BinaryPredicate pred);

Description

unique_copy copies the first element of each sequence of duplicates encountered in rng to out.

Equality is determined by the predicate if one is supplied, or by operator==() for SinglePassRange's value type.

Definition

Defined in the header file boost/range/algorithm/unique_copy.hpp

Requirements

For the non-predicate versions of unique:

For the predicate versions of unique:

Complexity

Linear. O(N) where N is distance(rng). Exactly distance(rng) comparisons are performed.


PrevUpHomeNext