Ranges seem awkward to work with

Jesse Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 11 18:43:20 PDT 2017


On Tuesday, 12 September 2017 at 01:18:21 UTC, Nicholas Wilson 
wrote:
> On Tuesday, 12 September 2017 at 01:13:29 UTC, Hasen Judy wrote:
>> Is this is a common beginner issue?
>
> if `range.save` works use that, otherwise

std.csv does not, IIRC.

>
> `range.dup` will duplicate the range

That isn't a range property.


> or `range.array` (from std.array) will enumerate the range into 
> an array (which is pretty much the same as your solution above.

This. Ranges are great in part because they are often lazy, a 
sequence of operations can be defined but only executed when 
used. Some operations need the whole collection, eg sort.


More information about the Digitalmars-d-learn mailing list