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

Dennis <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #2 from Dennis <[email protected]> ---
Usually when a template function accepts a generic struct/class, the
constraints test for capabilities (like having a certain property or operator
overload) that the function wants to use on a parameter of that type.

Implicitly converting is an operation that you might want to do. Being derived
from a specific class is not an operation on its own. If you do something that
only works with derived classes, like array conversion based on covariance, you
can test for that specifically:

if(is(const(T)[] : const(U)[])

That would also makes it clear *why* you specifically allow derived classes
from `U` but not classes that convert to `U`.

I'm really interested in seeing the function where you want to use this trait,
because I suspect it's trying to solve a problem that should be solved
elsewhere.

--

Reply via email to