Next : , Previous : Remove, Top : Table of  Contents


Unique

ForwardIterator unique (ForwardIterator first, ForwardIterator last) Function
ForwardIterator unique (ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred) Function

template 
ForwardIterator unique(ForwardIterator first, ForwardIterator last);

template 
ForwardIterator unique(ForwardIterator first, ForwardIterator last,
                       BinaryPredicate binary_pred);

unique eliminates all but the first element from every consecutive group of equal elements referred to by the iterator i in the range [first, last) for which the following corresponding conditions hold: *i == *(i -1) or binary_pred(*i, *(i - 1)) == true. unique returns the end of the resulting range. Exactly (last - first) - 1 applications of the corresponding predicate are done.

OutputIterator unique_copy (InputIterator first, InputIterator last, OutputIterator result) Function
OutputIterator unique_copy (InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate binary_pred) Function

template 









OutputIterator unique_copy(InputIterator first, InputIterator last,
                           OutputIterator result);

template 





OutputIterator unique_copy(InputIterator first, InputIterator last,
                           OutputIterator result, BinaryPredicate binary_pred);

unique_copy copies only the first element from every consecutive group of equal elements referred to by the iterator i in the range [first, last) for which the following corresponding conditions hold: *i == *(i -1) or binary_pred(*i, *(i - 1)) == true. unique_copy returns the end of the resulting range. Exactly last - first applications of the corresponding predicate are done.