On Monday, 15 February 2021 at 07:26:56 UTC, Jack wrote:
I need to check if an instance is of a specific type derived
from my base class but this class has template parameter and
this type isn't available at time I'm checking it. Something
like:
class B { }
class A(T) : B { }
class X : B { }
class Z : B { }
auto c = can be any derived class from B
bool isX = cast(A!???) c !is null;
assert(isX);
You have object instance, why not just use virtual function?
https://forum.dlang.org/post/gemozfonxoohojtlb...@forum.dlang.org
Cast always smells hacking.