https://issues.dlang.org/show_bug.cgi?id=5710

--- Comment #33 from Sobirari Muhomori <dfj1es...@sneakemail.com> ---
A slightly more straightforward solution: the passed context is effectively a
closure, and it can contain any variables, so let's just pass this pointer in
the closure context struct. All the rules of closures apply.

struct main_add_closure_context
{
  auto var1;
  auto var2;
  Foo foo_this;
  auto var3;
  auto var4;
}

This context is like any normal closure, the `add` can simply use it. Also pass
it instead of `this` argument to doStuff(alias fun), which in its turn should
be taught to get `this` reference from the passed context struct.

--

Reply via email to