Eigenpoll : D wish list : C++ Member Pointers 

This is a simple syntax which could be used to create C++ style member pointers in D.
I think member pointers are useful because you can create a pointer to a function, and pass any object you want to that function. This cannot be done with delegates, as delegates are fixed to a single object.

class N{
void foo(){ }
void fooi(int v){ }
}

N obj = new N();

void function(N)() ptr = &N.foo;
void function(N)(int) ptri = &N.fooi;

ptr(obj)();
ptri(obj)(35);


This syntax also allows you to easily convert a member pointer to a delegate.

void delegate(int) dgi = ptri(obj);

Report this item for cleanup