struct S { this(string s) { type = Type.type1; }
this(int n) { type = Type.type2; } Type type; int n; } int value(S s)() { static if(s.type == Type.type2) { // do something } return n; }
struct S { this(string s) { type = Type.type1; }
this(int n) { type = Type.type2; } Type type; int n; } int value(S s)() { static if(s.type == Type.type2) { // do something } return n; }