On Thursday, 9 May 2013 at 13:27:35 UTC, Steven Schveighoffer wrote:
template GetString(T) if (is(T == int) || is(T == float) || ...)
{
   enum string GetString = T.stringof;
}

Current idiomatic D way to handle both built-in types and symbols looks like this:

template Hello(T...)
    if (T.length == 1)
{
    static if (is(T[0]))
        // ...
    else
        // ...
}

I actually don't understand why it accepts literals as those are not symbols and, for example, you can't attach UDA to literal.

Reply via email to