July 14, 2012 [Issue 8388] New: std.traits.MemberFunctionsTuple doesn't work with constructors or destructors | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8388 Summary: std.traits.MemberFunctionsTuple doesn't work with constructors or destructors Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: jmdavisProg@gmx.com --- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-13 22:52:08 PDT --- This code import std.stdio; import std.traits; class C { this() {} this(int i) {} this(int i, float j) {} this(string s) {} ~this() {} } void main() { writeln(__traits(hasMember, C, "__ctor")); writeln(__traits(hasMember, C, "__dtor")); foreach(f; MemberFunctionsTuple!(C, "__ctor")) writeln(f.stringof); foreach(f; MemberFunctionsTuple!(C, "__dtor")) writeln(f.stringof); } prints true true The MemberFunctionsTuple results are empty. The constructors and destructor should be listed, but none are. So, clearly, while hasMember properly finds the constructors and destructor, MemberFunctionsTuple does not. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 14, 2012 [Issue 8388] std.traits.MemberFunctionsTuple doesn't work with constructors or destructors | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=8388 --- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-13 23:33:57 PDT --- It looks like MermberFunctionsTuple only grabs virtual functions. This code import std.stdio; import std.traits; class C { void foo()() {} void goo() { foo(); } } void main() { foreach(f; MemberFunctionsTuple!(C, "foo")) writeln(f.stringof); foreach(f; MemberFunctionsTuple!(C, "goo")) writeln(f.stringof); } just prints goo() foo() isn't printed. So, the constructors and destructor probably aren't being grabbed, because they're non-virtual. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation