macros: type save, or what?
0ffh
spam at frankhirsch.net
Tue Sep 11 12:04:57 PDT 2007
As to the matter of type save macros:
Using some imaginary macro sytax (as I don't know the real one),
but with all confidence that this will work with D macros.
macro inc(a)
// increment an integer
{
static if (typeof(a).stringof=="int")
{
++a;
}
else
{
// raise compile time error
static assert(false,"inc wanna int!!11!");
}
}
There might even be a more elegant way, but what teh heck... :)
Regards, Frank
More information about the Digitalmars-d
mailing list