drug:

Also can I avoid "dummy" non-default ctor for Bar?

One solution:


struct Foo {
    int foo;

    @disable this();

    this(int foo_) pure nothrow @safe @nogc {
        this.foo = foo_;
    }
}

struct Bar {
    enum arraySize = 3;

    Foo[arraySize] foo = Foo(1);
}

void main() @safe {
    import std.stdio;

    Bar bar;
    bar.writeln;
}


Bye,
bearophile

Reply via email to