daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Nov 28th, 2018 98 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 );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top