How to make delegate refer to itself?

Philippe Sigaud philippe.sigaud at gmail.com
Sat Nov 23 15:24:53 PST 2013


On Sat, Nov 23, 2013 at 11:57 PM, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> void delegate(Event) dg = (Event e) {
>                 if (e == ...)
>                         queue.remove(dg); // NG: Still complains 'dg' isn't defined
>         };
>         queue.register(dg);

Did you try this?

void delegate(Event) dg;

dg = (Event e) {
    if (e == ...)
        queue.remove(dg); // NG: Still complains 'dg' isn't defined
};

queue.register(dg);


More information about the Digitalmars-d-learn mailing list