how to get fully qualified name of a template function (if possible at CT)
Ellery Newcomer
ellery-newcomer at utulsa.edu
Mon Aug 27 10:01:11 PDT 2012
On 08/24/2012 11:16 PM, timotheecour wrote:
> how to get fully qualified name of a template function?
> In the code below I want to get "util.mod.mymethod!(double)"
> I tried everything (see below) to no avail, it just returns "mymethod";
> The closest I get is demangle(mangledName!(fun)), which shouldn't be
> hard to convert to what I want, but demangle is runtime, not compile time.
Way back when, Don wrote some code which does just this. Recently I have
been whacking with a hammer, so while you're waiting for
fullyQualifiedName to not fail, you might try it.
https://bitbucket.org/ariovistus/pyd/src/19bef7310180/infrastructure/meta
module util.mod;
import meta.Nameof;
void mymethod(T)(){}
void main(){ fun_aux!(mymethod!double);}
void fun_aux(alias fun)(){
pragma(msg, qualifiednameof!fun);
pragma(msg, prettynameof!fun);
}
gives
util.mod.mymethod.mymethod
void util.mod.mymethod!(double).mymethod()
More information about the Digitalmars-d-learn
mailing list