Object pointer from delegate
BCS
BCS at pathlink.com
Mon Aug 28 08:58:05 PDT 2006
Lutger wrote:
> Thanks! This can be useful if needed. Imho it would be nice if there was
> a delegate property to get the object pointer.
>
Not all delegates have a Object pointer in them.
class C
{
int j;
int m(){return j;}
}
int fn(bool b)
{
int i;
int nfn()
{
return i;
}
auto dg = b ? &nfn : &(new C).m;
// context on dg might be an Object or a stack frame
return dg();
}
More information about the Digitalmars-d-learn
mailing list