Syntactic Sugar for Construction of Empty Dynamic Arrays of a Given Type

bearophile bearophileHUGS at lycos.com
Sun Mar 23 07:58:51 PDT 2014


Nordlöw:

> Is there a convenicene function for assigning an empty dynamic 
> array of a given type to a variable?
>
>     cast(int[])[];

>                     _range = cast(D[])[];

If the variable is already typed, you can use [] otherwise you 
can use cast(T)[]  or (T[]).init to avoid casts.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list