Address of overloaded functions

John Colvin john.loughran.colvin at gmail.com
Wed Jul 3 08:15:48 PDT 2013


On Wednesday, 3 July 2013 at 15:03:46 UTC, Artur Skawina wrote:
> On 07/03/13 16:52, 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
>> }
>
>     void function(long) b = &foo;
>
> artur

Thanks, that works


More information about the Digitalmars-d-learn mailing list