__traits(allMembers) and aliases
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 26 05:42:05 PDT 2015
On Tuesday, 25 August 2015 at 16:08:48 UTC, Rikki Cattermole
wrote:
\> While my memory especially at 4am is rusty here:
>
> enum isVarDecl = __traits(compiles, {mixin(GOT ~ " got;");});
>
> Where GOT is assumed to be the string that you got from
> __traits(allMembers.
> It'll be true that it is a variable declaration. False for
> anything else e.g. a type.
This doesn't help me distinguish aliased function names. The
ideal thing to do is simply to check isFunctionPtr and hasUDA. I
don't want to put any restrictions on what the user can have in
the module/class/struct that contains the function pointer. It's
just that aliased function names pass both tests as they are
synonyms for the functions they alias.
More information about the Digitalmars-d-learn
mailing list