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];

And if that scares you:

auto slice(T)(T[] t, size_t start, size_t len) {
    return t[base .. $][0 .. len];
}

int[] arr;
arr.slice(3, 5);

Reply via email to