Suggestion: array slice through arr[base, size]

Zach the Mystic via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 8 11:11:34 PST 2015


On Sunday, 8 February 2015 at 15:28:10 UTC, Vladimir Panteleev 
wrote:
> On Sunday, 8 February 2015 at 15:20:17 UTC, karl wrote:
>> Hi, it's a bit unwieldy to write/read this:
>> result = src[base .. base+size];
>> instead of:
>> result = src[base, size];
>
> If you don't want to write "base" twice, you can write:
>
> result = src[base..$][0..size];

That's really interesting!


More information about the Digitalmars-d mailing list