Determine type of property

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 1 19:36:25 PST 2016


S has 3 different properties, x, y, z:

struct S
{
    int x;
    int y() { return 1;}
}

int z(S s) { return 1;}

pragma(msg, typeof(S.init.x).stringof); // int
pragma(msg, typeof(S.init.y).stringof); // int()
pragma(msg, typeof(S.init.z).stringof); // int

Is there a trait I can call/use to consistently get "int" from all 3?

-Steve


More information about the Digitalmars-d-learn mailing list