tupleof of class instance... but enumerate _all_ the instance variables
Nick Treleaven
nick at geany.org
Sun Jun 29 10:49:23 UTC 2025
On Sunday, 29 June 2025 at 03:50:03 UTC, Andy Valencia wrote:
> On Saturday, 28 June 2025 at 10:41:47 UTC, Nick Treleaven wrote:
>
>> static if (is(D Bases == super))
>
> Wow. I can't find that in _any_ of my references on D...
> including the language spec itself. Nor in Phobos source...
> what is a "D Bases", please? Uncle!
Ali's given a great answer, I'll just add that there's a Phobos
trait I could've used which reads better and avoids the initial
`static if` nesting (where the condition is always true):
```d
alias Bases = BaseClassesTuple!D;
```
That also avoids listing any interfaces the class may implement.
https://dlang.org/phobos/std_traits.html#BaseTypeTuple
More information about the Digitalmars-d-learn
mailing list