uniq

fnauto uniq(alias pred = "a == b", Range)(Range r) if (isInputRange!Range && is(typeof(binaryFun!pred(r.front, r.front)) == bool))

Lazily iterates unique consecutive elements of the given range, which is assumed to be sorted (functionality akin to the

_uniq system

utility). Equivalence of elements is assessed by using the predicate pred, by default "a == b". The predicate is passed to

binaryFun, and can either accept a string, or any callable

that can be executed via pred(element, element). If the given range is bidirectional, uniq also yields a

bidirectional range.

Parameters

predPredicate for determining equivalence between range elements.
rAn input range of elements to filter.

Returns

An input range of

consecutively unique elements in the original range. If r is also a forward range or bidirectional range, the returned range will be likewise.