Invalid bounding interval [, ]
Timon Gehr
timon.gehr at gmx.ch
Wed Jan 25 05:54:51 PST 2012
On 01/25/2012 12:28 PM, C wrote:
>> auto chunk = new ubyte[1024];
>> foreach(ref x; chunk) x = uniform!"[]"(ubyte.min, ubyte.max);
>
> Thank you all for your replies.
>
> @ Timon, I have two questions:
> 1) How come you can omit parentheses for uniform's parameter, shouldn't it be
> uniform!("[]")(...) ?
If there is only one template argument, parentheses can be omitted.
> 2) Does auto chunk = new ubyte[1024]; ALWAYS create a dynamic array with
> changeable length?
> That is a silly question but the syntax confuses me.
Yes it does. But this works too and is probably more intuitive if you
are not familiar with other C-derived languages:
auto chunk = new ubyte[](1024);
More information about the Digitalmars-d-learn
mailing list