int[] as constructor
jmh530
john.michael.hall at gmail.com
Wed Dec 5 00:29:59 UTC 2018
On Tuesday, 4 December 2018 at 22:35:48 UTC, Jonathan M Davis
wrote:
> On Tuesday, December 4, 2018 3:17:04 PM MST jmh530 via
> Digitalmars-d-learn wrote:
>> I've noticed that I can use int like a constructor, as in:
>> int x = int(1);
>> but I can't do the same thing with slices
>> int[] y = int[]([1, 2]);
>>
>> Is there something I'm missing here or is this a potential
>> enhancement? It can make some types of generic code a little
>> more annoying.
>
> Using parens with dynamic arrays already has a different
> meaning. It's how you provide the size of the dynamic array.
> e.g.
> [snip]
I don't think I either knew or had remembered this, thanks.
More information about the Digitalmars-d-learn
mailing list