On Monday, 18 January 2021 at 18:40:37 UTC, Jack wrote:
isInstanceOf from std.traits seems to not work with class the way I need to. I'd like to make a template function accepts only class of a specified class type

class A { }
class B : A { }
class C : A { }

int f(T)(in A[int] arr)

Use

if(is(T : A))

the syntax there is similar to the class declaration itself.

isInstanceOf is for checking instances of templates rather than classes.

Reply via email to