Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Test program for determining if alias-this symbols are included
- // in __traits's getOverloads results.
- // (Spoilers: They are not.)
- import std.stdio;
- struct Foo
- {
- int doTheThing()
- {
- return 57;
- }
- }
- struct Bar
- {
- Foo foo;
- alias foo this;
- string doTheThing(float ifYouSaySo)
- {
- import std.conv;
- return "If you say so: "~ifYouSaySo.to!string;
- }
- }
- void main()
- {
- // The below prints "string(float ifYouSaySo)" as of dmd 2.093.
- // Foo's version of the function is callable, but does not appear
- // in the overload list.
- foreach( func; __traits(getOverloads, Bar, "doTheThing", true) )
- writeln(typeof(func).stringof);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement