How to store unique values of array in another array

Adam D. Ruppe destructionator at gmail.com
Thu Oct 18 18:53:06 UTC 2018


On Thursday, 18 October 2018 at 18:39:18 UTC, Samir wrote:
> which leads me to believe that the output of `uniq` is not 
> necessarily another integer array.

Right, it is actually a "range" - an object that generates the 
result on-demand, so it doesn't do work you don't actually need. 
If you don't need an array per se, you can just foreach over it 
and print them or further work on it without the cost of creating 
a new array.

But, if you need to copy it into a new array, use `.array` at the 
end.


More information about the Digitalmars-d-learn mailing list