Address of overloaded functions

Dicebot public at dicebot.lv
Wed Jul 3 08:04:59 PDT 2013


On Wednesday, 3 July 2013 at 14:52:32 UTC, John Colvin wrote:
> Is there any way to take the address of any of an overloaded 
> set of functions?
>
> import std.stdio;
>
> void foo(int a){ writeln("overload int"); }
> void foo(long b){ writeln("overload long"); }
>
> void main()
> {
>     auto b = &foo; //ambiguous => error
>     b(2); //valid for either overload
> }

http://dpaste.dzfl.pl/1e705a3b


More information about the Digitalmars-d-learn mailing list