SHOW:
|
|
- or go back to the newest paste.
1 | - | mixin Inherits( T ) |
1 | + | mixin Inherits( T... ) |
2 | { | |
3 | - | T base; |
3 | + | static foreach( Index, ST; T ) |
4 | - | alias base this; |
4 | + | { |
5 | mixin( "ST base" ~ Index.to!string ~ ";" ); | |
6 | } | |
7 | alias base0 this; | |
8 | } | |
9 | ||
10 | struct Object1 | |
11 | { | |
12 | int foo; | |
13 | } | |
14 | - | mixin Inherits!Object1; |
14 | + | |
15 | - | alias base this; |
15 | + | struct Object3 |
16 | { | |
17 | int notFoo; | |
18 | } | |
19 | ||
20 | struct Object2 | |
21 | { | |
22 | mixin Inherits!( Object1, Object3 ); | |
23 | int bar; | |
24 | } | |
25 | ||
26 | pragma( msg, Object2.init.foo ); |