Learning to use ranges instead of arrays
Bob Tolbert via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jul 20 09:13:54 PDT 2014
On Sunday, 20 July 2014 at 16:11:03 UTC, John Colvin wrote:
>
> Even without ranges, you can do this:
>
> string [] fileList;
>
> ... fill list
>
> if (sort)
> sort(fileList);
>
> foreach(filename, fileList) {
> ... do something;
> }
>
> because sort works in-place.
Oh, I see that now. Guess when I saw it returned a SortedRange, I
stopped reading and missed the bit about the underlying array
also being sorted.
Thanks for the quick help,
Bob
More information about the Digitalmars-d-learn
mailing list