Why doesn't this throw?

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri May 25 05:59:47 PDT 2012


import std.algorithm;
import std.stdio;

void main()
{
    int[] a = [1, 2, 3];
    a = a.remove(3);
    writeln(a);
}

writes [1, 2]

If I'd called a.remove with index 2 I would get the above result, but
index 3 is clearly out of bounds, so why'd it remove the last element
instead of throwing?


More information about the Digitalmars-d-learn mailing list