inferred size for static array initialization

Namespace via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 2 12:02:51 PDT 2016


On Monday, 2 May 2016 at 18:57:49 UTC, Namespace wrote:
>> A slice of a no-longer-existing temporary! Admittedly, this is 
>> not an issue with your code, but a deeper issue of allowing 
>> slicing of rvalues.
> This works:
> ----
> int[] as = [1, 2, 3].s;
> writeln(as[2]);

Of course this slice is only valid as long as you dont leave the 
scope. That's maybe what you tried to say, right?


More information about the Digitalmars-d-learn mailing list