On Saturday, 18 March 2017 at 02:23:01 UTC, Hussien wrote:


I need the general solution. One that simply returns the type. None of what you said helps...

string dtype(T)() {
    static if(is(T == enum)) return "enum";
    else static if(is(T == class)) return "class";
    else static if(is(T == struct)) return "struct";
    // etc...
}

void main() {
    struct Foo {};
    assert(dtype!Foo == "struct");
}

Reply via email to