Mixin helper help
Salih Dincer
salihdb at hotmail.com
Fri Jan 13 14:32:44 UTC 2023
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 at 79
More information about the Digitalmars-d-learn
mailing list