static const and user attribute

Jack Applegame japplegame at gmail.com
Wed May 29 06:30:11 PDT 2013


Which difference between enum and static const with initializer?

struct A {
     @("enum") enum int c1 = 10;
     @("const") static const int c2 = 20;
}

static assert(__traits(getAttributes, A.c1)[0] == "enum");
static assert(__traits(getAttributes, A.c2)[0] == "const"); // 
error

http://dpaste.dzfl.pl/7887ef90


More information about the Digitalmars-d-learn mailing list