Re: address of overloaded function

2015-10-01 Thread Jacob Carlborg via Digitalmars-d-learn

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 = 
 void delegate(int) @property set = 
}
---


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

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

void main()
{
int function () a = 
void function (int) b = 
}

--
/Jacob Carlborg


address of overloaded function

2015-09-30 Thread Freddy via Digitalmars-d-learn
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 = 
void delegate(int) @property set = 
}
---


Re: address of overloaded function

2015-09-30 Thread Adam D. Ruppe via Digitalmars-d-learn

On Wednesday, 30 September 2015 at 22:48:03 UTC, Freddy wrote:
How do you take the address of a specific overloaded function. 
This won't compile


You can write a helper function that uses __traits(getOverloads) 
and searches them for the right signature:


http://dlang.org/traits.html#getOverloads