Re: Traits problem

2010-01-02 Thread Trass3r
Daniel Ribeiro Maciel schrieb: > void main() { enum string[] members = __traits(allMembers, Foo ); foreach( member; members ) writeln( typeid(typeof(__traits(getVirtualFunctions, Foo, member) )) ); } Is that possible? __traits is a really immature thing. There's this bug

Re: Traits problem

2009-12-05 Thread bearophile
Daniel Ribeiro Maciel: Note that this foreach is a static foreach because members is a tuple, it's not an array: > void exportObject( TClass, members... )() > { > foreach( uint i, member; members ) > writeln( typeid(typeof(__traits(getVirtualFunctions, Foo, members[i]) > )) ); > }

Re: Traits problem

2009-12-05 Thread Daniel Ribeiro Maciel
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,

Re: Traits problem

2009-12-04 Thread Daniel Ribeiro Maciel
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(getVirt

Re: Traits problem

2009-12-04 Thread bearophile
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 enu

Traits problem

2009-12-04 Thread Daniel Ribeiro Maciel
Hello! I'm trying to use __traits in the following manner: import std.stdio; import std.traits; class Foo { void bla() { } void foo() { } } int main() { immutable string members[] = [ "bla", "foo" ]; writeln( typeid(typeof(__traits(getVirtualFunctions, Foo, members[0]) )) ); }