digitalmars.D.learn - Get function name at compile time?
- Sean Eskapp (7/7) Feb 12 2011 Is there a way to get a function's name at compile time, for instance as...
- Simen kjaeraas (8/17) Feb 12 2011 This should work (and does for me):
Is there a way to get a function's name at compile time, for instance as part
of a template? Using .stringof doesn't work, and I can't find another way to
do it. Any help?
class FunctionWrapper(alias func)
{
string name = func.stringof;
}
Feb 12 2011
Sean Eskapp <eatingstaples gmail.com> wrote:
Is there a way to get a function's name at compile time, for instance as
part
of a template? Using .stringof doesn't work, and I can't find another
way to
do it. Any help?
class FunctionWrapper(alias func)
{
string name = func.stringof;
}
This should work (and does for me):
class FunctionWrapper(alias func)
{
string name = __traits(identifier, func);
}
--
Simen
Feb 12 2011








"Simen kjaeraas" <simen.kjaras gmail.com>