On Tuesday, 10 May 2016 at 15:33:03 UTC, chmike wrote:
Thanks. This does the job but it's not as concise.

I've never missed C++'s bind functionality because D has first class support for delegates.

If async_task is changed to the following:

void async_task(void delegate(int error) cb) { . . . while cb(0) . . . }

You could just adapt a call to it using a lambda function:

async_task( (error) => myCb(error, count) );

D makes sure the enclosing stack is copied to the heap and count is reachable. Maybe this helps...

Regards,
André

Reply via email to