static array with inferred size

Dgame r.schuett.1987 at gmail.com
Wed Sep 20 08:39:49 UTC 2017


On Wednesday, 20 September 2017 at 08:33:34 UTC, Nordlöw wrote:
> On Wednesday, 20 September 2017 at 07:38:00 UTC, Jonathan M 
> Davis wrote:
>> T[n] s(T, size_t n)(auto ref T[n] array) pure nothrow @nogc 
>> @safe
>> {
>>     return array;
>> }
>
> What about adding `s` to std.array in the meanwhile? I wonder 
> what Walter says about the static array to slice assignment. 
> Isn't it memory-safe?

Maybe even in object.d so that [1, 2, 3].s is possible without 
any import. Then it would look like a built-in feature.


More information about the Digitalmars-d mailing list