Referencing an overloaded function

John nospam at unavailable.com
Sat Mar 24 05:13:07 PDT 2012


Is there any way to refer to a specific function overload?

For example:

import std.stdio;
import std.traits;

void foo() {}
void foo(int x) {}

void main() {
     writeln(foo.mangleof);
     writeln(ParameterTypeTuple!(foo).stringof);
}

Both of these statements always refer to the first matching 
function.  If I change the order of declarations for foo, the 
results change.

Is there a way to reference the second overload in this example?

I can use a function pointer with ParameterTypeTuple to get the 
correct result, but something like mangleof won't work, since 
that will return the mangle of the local function pointer instead 
of the original function.


More information about the Digitalmars-d-learn mailing list