static arrays at runtime with templates ?

XavierAP n3minis-git at yahoo.es
Mon Feb 4 16:08:38 UTC 2019


On Sunday, 3 February 2019 at 16:33:48 UTC, Emil wrote:
>
> Is this for real, static arrays at runtime without manually 
> allocating memory ? Is this legitimate or should I expect 
> problems ?

Static arrays are always allocated at run-time. It's the size of 
the array that must be known at compile-time (in this case via a 
template parameter).

What's the advantage (or the essential difference) of
     auto data = static_array!(int, 5);
instead of
     int[5] data;
? Just asking ;) but it's good to play.

What does not compile on my end are the run-time parameters (3) 
and (2)...?


More information about the Digitalmars-d-learn mailing list