[Issue 24892] We need a __traits trait to test for whether one class is derived from another

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 6 02:30:38 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24892

Richard (Rikki) Andrew Cattermole <alphaglosined at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alphaglosined at gmail.com

--- Comment #1 from Richard (Rikki) Andrew Cattermole <alphaglosined at gmail.com> ---
What I am going to suggest instead of a trait, is to use > and <.

I.e.

``is(Child > Parent)``

``is(Parent < Child)``

This will also work with template parameters:

```d
void func(T > Parent)(T thing) {
}
```

Another benefit of this, is that it can be a direct 1:1 replacement.

--


More information about the Digitalmars-d-bugs mailing list