July 14, 2013 Re: Conditional Inheritance | ||||
---|---|---|---|---|
| ||||
Posted in reply to lomereiter | On 07/14/2013 11:37 AM, lomereiter wrote: >> I assume that you template ends up creating a dummy interface though >> and this isn't really acceptable. > > Yes, it does. Once ':' is typed, some inheritance must occur. > Nope. template Seq(T...){ alias T Seq; } class C : Seq!(){ } > Why isn't a dummy interface acceptable? It creates unnecessary bloat. template conditionallyInherit(bool inherit, T) { static if(inherit) alias T conditionallyInherit; else alias Seq!() conditionallyInherit; } |
July 15, 2013 Re: Conditional Inheritance | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | Thanks. Now I realise that D is much less intuitive than C++. |
Copyright © 1999-2021 by the D Language Foundation