On 10/10/2017 03:36 PM, Simon Bürger wrote:
I have a static array inside a struct which I would like to be initialized to all-zero like sostruct Foo(size_t n) { double[n] bar = ... all zeroes ... } (note that the default-initializer of double is nan, and not zero) I tried double[n] bar = 0; // does not compile
Works for me: ---- struct Foo(size_t n) { double[n] bar = 0; } void main() { import std.stdio; Foo!5 foo; writeln(foo.bar); /* prints "[0, 0, 0, 0, 0]" */ } ----