Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Function template unique

boost::movelib::unique

Synopsis

// In header: <boost/move/algo/unique.hpp>


template<typename ForwardIterator, typename BinaryPredicate> 
  ForwardIterator 
  unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);

Description

Requires: The comparison function shall be an equivalence relation. The type of *first shall satisfy the MoveAssignable requirements

Effects: For a nonempty range, eliminates all but the first element from every consecutive group of equivalent elements referred to by the iterator i in the range [first + 1, last) for which the following conditions hold: pred(*(i - 1), *i) != false.

Returns: The end of the resulting range.

Complexity: For nonempty ranges, exactly (last - first) - 1 applications of the corresponding predicate.


PrevUpHomeNext