how do I prevent null errors when using __traits(derivedMembers

Pedro Lopes via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 2 05:09:09 PDT 2016


Hello,

I've been poking around with "__traits", and I came across a 
problem:
whenever I run a code like this 
"__traits(derivedMembers,members[i]);"

  I inevitably find a member that has no derived members, and 
inevitably the compiler tells me that I have an error: "Error: 
argument has no members", how do I check if a member has derived 
elements or if it has other elements contained within it?

the "members[i]" is an array of members retrieved from  
"__traits(allMembers, someModule);"


I'm trying to map all elements of an unspecified module for 
auto-completion and suggestion purposes, and I was wondering if 
there was a simpler/better ways to do that.

Thank you.


More information about the Digitalmars-d-learn mailing list