On Sat, Mar 24, 2012 at 13:13, John <nos...@unavailable.com> wrote: > Is there any way to refer to a specific function overload?
You can use __traits(getOverloads, aggregate, "member") to get all overloads of member aggregate.member. Where an aggregate is a class, a struct or a module. module pack.mod; // needs to be XXX.YYY for __traits to work void foo() {} void foo(int x) {} template Alias(A...) { alias A Alias;} void main() { // The Alias!( ) trick is needed to work around a limitation in alias X Y grammar // __traits() is not accepted in an alias: alias __traits(getOverloads, X, "Y") OV_XY; does not work alias Alias!(__traits(getOverloads, pack.mod, "foo")) OV; // OV is a tuple holding all the different foo's foreach(i, ov; OV) writefln("overload #%s: %s", i, typeof(ov).stringof); alias OV[1] intFoo; // void foo(int x) {} intFoo(1); // calls void foo(int x) {} }