Address of overloaded functions

Artur Skawina art.08.09 at gmail.com
Wed Jul 3 08:26:10 PDT 2013


On 07/03/13 17:17, John Colvin wrote:
> On Wednesday, 3 July 2013 at 15:05:00 UTC, Dicebot wrote:
>> 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
> 
> It's a pity that only work within an aggregate (the documentation actually says only classes)

http://forum.dlang.org/thread/xamuenbcabnhrtqjjizw@forum.dlang.org#post-mailman.1122.1332633715.4860.digitalmars-d-learn:40puremagic.com

artur


More information about the Digitalmars-d-learn mailing list