Finding Super class from Derived Class at compile time
Adam D. Ruppe
destructionator at gmail.com
Mon Apr 15 22:45:59 UTC 2019
On Monday, 15 April 2019 at 05:20:37 UTC, Ali Çehreli wrote:
> BaseClassesTuple and friends:
>
> https://dlang.org/phobos/std_traits.html
And the implementation of that is the `is` expression
https://dlang.org/spec/expression.html#IsExpression
specifically, with the `super` keyword.
static if (is(YourClass ListOfBaseTypes == super))
// use ListOfBaseTypes here; you can foreach, index, or slice
it to get what you are looking for.
More information about the Digitalmars-d-learn
mailing list