Advertisement
Guest User

Untitled

a guest
Nov 28th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mixin Inherits( T... )
  2. {
  3.     static foreach( Index, ST; T )
  4.     {
  5.         mixin( "ST base" ~ Index.to!string ~ ";" );
  6.     }
  7.     alias base0 this;
  8. }
  9.  
  10. struct Object1
  11. {
  12.     int foo;
  13. }
  14.  
  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 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement