static arrays at runtime with templates ?
Emil
emilper at gmail.com
Mon Feb 4 19:14:38 UTC 2019
On Monday, 4 February 2019 at 16:08:38 UTC, XavierAP wrote:
> 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)...?
you are correct ...
24 hours of being very satisfied with myself were good, but also
good thing I did not quit and start looking for a D job
Can std.array.staticArray build static arrays with size known
only at run time ? Now that I am not overcome with enthousiasm it
looks like it too needs to know the size.
More information about the Digitalmars-d-learn
mailing list