initializing a static array

Simon Bürger simon.buerger at rwth-aachen.de
Tue Oct 10 14:20:01 UTC 2017


On Tuesday, 10 October 2017 at 13:54:16 UTC, Daniel Kozak wrote:
> struct Double
> {
>     double v = 0;
>     alias v this;
> }
>
> struct Foo(size_t n)
> {
>     Double[n] bar;
> }

Interesting approach. But this might introduce problems later. 
For example `Double` is implicitly convertible to `double`, but 
`Double[]` is not implicitly convertible to `double[]`. Therefore 
I will stick with jmh530's solution for now, but thank you anyway.



More information about the Digitalmars-d-learn mailing list