How to append range to array?

weaselcat via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 23 01:36:47 PDT 2015


On Saturday, 23 May 2015 at 08:35:45 UTC, weaselcat wrote:
> On Saturday, 23 May 2015 at 07:03:35 UTC, Vladimir Panteleev 
> wrote:
>> int[] arr = [1, 2, 3];
>> auto r = iota(4, 10);
>> // ???
>> assert(equal(arr, iota(1, 10)));
>
> import std.array : array;
> arr ~ r.array;

woops, meant ~=

but this is probably fairly inefficient. Working with ranges and
arrays at the same time feels really badly designed.


More information about the Digitalmars-d-learn mailing list