template alias

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Jan 23 12:09:54 PST 2011


Use the eponymous trick:

import std.stdio;
import std.traits;

template isBuiltInT(T)
{
    enum isBuiltInT = isNumeric!T || isSomeChar!T;
}

void main()
{
    assert(isBuiltInT!(int));
    assert(isBuiltInT!(char));
}


More information about the Digitalmars-d-learn mailing list