It would be cool, if the following would be possible. 
----
immutable string MemberID = "M";

struct A {}
struct B {
    alias A M;
}

template Member(T)
{
    static if(__traits(hasMember, T, MemberID))
    {
        alias __traits(getMember, T, MemberID) Member;
    }
    else
        alias TypeTuple!() Member;
}

void main()
{
    alias Member!(B) M;
}
----

Currently dmd will print "basic type expected, not __traits".
Why isn't traits allowed here and if we allow __traits there, would this 
introduce any ambiguities?

Tobias

Reply via email to