tell if __traits(allMembers, ... ) is an enum (not manifest constant)

nkgu via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 25 00:40:00 PST 2016


On Thursday, 25 February 2016 at 04:55:09 UTC, Nicholas Wilson 
wrote:
>
> oops should be
> writeln(typeof(__traits(getMember, vulkan_input,  m)).stringof);
> that compiles but still prints nothing

try

pragma(msg, typeof(__traits(getMember, vulkan_input,  
m)).stringof);

because at compile time the code generated for writeln() is not 
executed.

Also take care with the getMember trait, it will only work if the 
member is public.
(or not public but located in the module where the __traits() 
code resides).


More information about the Digitalmars-d-learn mailing list