Problem using __traits
Daniel Ribeiro Maciel
daniel.maciel at gmail.com
Fri Nov 7 20:02:23 PST 2008
I am having a problem trying to enumerate then call a method of a class.
I have the following situation
class Foo
{
void bar () { writefln( "hello" ); }
}
void traitsTest( TClass, string name )( TClass foo )
{
foreach( method; __traits( allMembers, TClass ) )
{
writefln( method );
__traits( getMember, foo, __traits( getVirtualFunctions, TClass, method )[0] )();
}
}
void main()
{
Foo foo;
traitsTest!( Foo, "foo" )( foo );
}
but I am getting "Error: string expected as second argument of __traits getVirtualFunctions instead of method" at line: __traits( getMember, foo, __traits( getVirtualFunctions, TClass, method )[0] )();
What am I doing wrong?
Best Regards,
Daniel
More information about the Digitalmars-d-learn
mailing list