Luna::List::unique

template <typename _BinaryPredicate>
usize unique(_BinaryPredicate p)

Removes all consecutive duplicate elements from the container.

Only the first element in each group of equal elements is left. Elements are compared using the user-provided binary predicate.

Parameters

  • in p

    The binary predicate which returns ​true if two elements are equal.

Return value

Returns the number of elements removed.

Valid Usage

  • p must provide the following function: bool operator()(const _Ty& a, const _Ty& b), that returns true if a and b is equal.