On 9/10/11 6:23 PM, dsimcha wrote:
On 9/10/2011 5:37 PM, dsimcha wrote:
* newArray could only take the element type as a template parameter; the
number of dimensions in unequivocally determined from the number of
arguments.

Good point. Actually, this can probably be changed in
std.array.uninitializedArray, too. There was some reason why I did it
the way I did, but I don't remember why. I'll look into it.

Ok, now I remember. It was so that if you give too many dimensions, it's
a compile time error, not a runtime error. For example:

auto foo = alloc.newArray!(int[][])(8, 6, 7, 5, 3, 0, 9); // Error

If you just require

auto foo = alloc.newArray!int(8, 6, 7, 5, 3, 0, 9);

there's never an error, the array is created with as many dimensions as numbers. A mistake in choosing that number will never get unnoticed because the array type will be screwed up.


Andrei

Reply via email to