Is there a way to get the list of names of a class' member	variables?
    Simen kjaeraas 
    simen.kjaras at gmail.com
       
    Sun Jul  4 03:51:21 PDT 2010
    
    
  
Jonathan M Davis <jmdavisprog at gmail.com> wrote:
> MemberFunctionsTuple() from std.traits will return the list of names of  
> member
> function, and FieldTypeTuple from std.traits will return the list of the  
> _types_
> of the member variables. But I don't see a function that returns the  
> list of the
> _names_ of the member variables. Am I just blind, or does such a  
> function not
> currently exist?
__traits[1] is your friend in these matters.
__traits( allMembers, Foo ) returns a tuple of string literals, each of
which corresponds to a member of Foo.
[1] http://www.digitalmars.com/d/2.0/traits.html
-- 
Simen
    
    
More information about the Digitalmars-d-learn
mailing list