address of overloaded function

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 1 00:15:22 PDT 2015


On 2015-10-01 00:48, Freddy wrote:
> How do you take the address of a specific overloaded function. This
> won't compile
> ---
> import std.range;
>
> void main()
> {
>      ForwardAssignable!int range;
>      int delegate() @property get = &range.front;
>      void delegate(int) @property set = &range.front;
> }
> ---

Not sure why that doesn't work. This works:

int foo () { return 0; }
void foo (int) {}

void main()
{
     int function () a = &foo;
     void function (int) b = &foo;
}

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list