On Thursday, 12 January 2023 at 08:03:34 UTC, John Chapman wrote:
Why does the commented code work but the mixin not? Thanks for any pointers.

Why not directly use the mixin template for opDispatch()?

```d
mixin template helper() {
  void opDispatch(string name)() {
    import std.stdio;
    writeln(12);
  }
}

struct Foo {
  mixin helper;
  // ...
}

void main() {
  Foo.init.opDispatch!"bar"();
}
```

SDB@79

Reply via email to