static arrays at runtime with templates ?

Paul Backus snarwin at
Tue Feb 5 12:13:04 UTC 2019

On Monday, 4 February 2019 at 22:48:10 UTC, XavierAP wrote:
> However one of the possibilities of D is the ability to 
> generate and execute quite some code at compile time by means 
> of meta-programming; and I guess here's where staticArray() may 
> end up being useful enough to have merited introduction into 
> the std library; not for trivial uses where a straightforward 
> T[n] declaration is preferable, being possible...

The main benefit of staticArray is that it allows the length of 
the array to be inferred from the initializer (like in C).

More information about the Digitalmars-d-learn mailing list