Why is std.algorithm so complicated to use?

Christophe Travert travert at phare.normalesup.org
Tue Jul 10 08:18:01 PDT 2012


Dmitry Olshansky , dans le message (digitalmars.D:171679), a écrit :
> Because uniq work only on sorted ranges? Have you tried reading docs?
> "
> Iterates unique consecutive elements of the given range (functionality 
> akin to the uniq system utility). Equivalence of elements is assessed by 
> using the predicate pred, by default "a == b". If the given range is 
> bidirectional, uniq also yields a bidirectional range.
> "

Not, as the doc says, uniq work on any range, but remove only the 
consecutive elements. It you want to remove all duplicates, 
then you need a sorted range.




More information about the Digitalmars-d mailing list