The strange part is that, for some reason, this works:
import std.stdio: writeln; class Foo { float bla() { return 0.0; } void foo() {} } void exportObject( TClass, members... )() { foreach( uint i, member; members ) writeln( typeid(typeof(__traits(getVirtualFunctions, Foo, members[i]) )) ); } void main() { exportObject!( Foo, "bla", "foo" )(); } Daniel Ribeiro Maciel Wrote: > Heya! > > Ok, let me explain what I want to do: > > > import std.stdio: writeln; > > class Foo { > float bla() { return 0.0; } > void foo() {} > } > > void main() { > enum string[] members = __traits(allMembers, Foo ); > foreach( member; members ) > writeln( typeid(typeof(__traits(getVirtualFunctions, Foo, member) )) > ); > } > > Is that possible? > > Best regards, > Daniel > > > bearophile Wrote: > > > Daniel Ribeiro Maciel: > > > > Try this: > > > > import std.stdio: writeln; > > > > class Foo { > > float bla() { return 0.0; } > > void foo() {} > > } > > > > void main() { > > enum string[] members = ["bla", "foo"]; > > writeln( typeid(typeof(__traits(getVirtualFunctions, Foo, members[0]) > > )) ); > > } > > > > Output: (float()) > > You need enum there, unfortunately. Also note the position of [], the lack > > of traits import, the qualified import from std.stdio, the void return of > > main, and so on. > > > > Bye, > > bearophile >