On Monday, 16 December 2019 at 18:01:06 UTC, Steven Schveighoffer
wrote:
I'd compare the typeid directly:
auto tid = typeid(object);
return(tid is typeid(X) || tid is typeid(Y) || tid is typeid(Z)
|| ...)
If you are doing a cast(const(X))object, what you are doing is
each time traversing the linked-list of typeids anyway doing
the same as the above, but doing extra work. So this should be
faster.
-Steve
Great. Thanks.
Because we're only interested in non-abstract classes I adjusted
your code to
static foreach (Type; AliasSeq!(...))
{
static assert(!__traits(isAbstractClass, Type));
if (zingid is typeid(Type)) { return true; }
}