Default struct member initializer ?

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 28 04:23:47 PDT 2016


On Friday, 28 October 2016 at 11:20:50 UTC, Temtaime wrote:
> Hi !
>
> Is there such a magic ?
>
> struct S { uint k = 2; }
>
> enum Value = Foo!(S.k); // Value == 2
>
> Thanks.

struct S { int k = 2; }

enum Value = S.init.k;

static assert (Value == 2);


More information about the Digitalmars-d mailing list