[Issue 19530] New proposed syntax for mixins

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 31 14:29:32 UTC 2018


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

Adam D. Ruppe <destructionator at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator at gmail.com

--- Comment #2 from Adam D. Ruppe <destructionator at gmail.com> ---
You can just define a third template that mixes in the first two.

mixin template A(int x, float y) {
  // ...
}

mixin template B(int x, float y) {
  // ...
}

mixin template composite(int x, float y) {
        mixin A!(x, y);
        mixin B!(x, y);
}

struct Test {
        mixin composite!(1, 2.0);
}


That works today.

--


More information about the Digitalmars-d-bugs mailing list