isSubtypeOf<TSuper> method
Returns true if instance of T
is applicable to TSuper
,
as if you would check new T() is TSuper
.
WARNING:
isSubtypeOf<T, void>()
will always return true, since void is dynamic at runtime.
To check if T is void, use:
TypeCheck<void>().isSubtypeOf<T>()
which does not work for dynamic (as stated above).
Implementation
bool isSubtypeOf<TSuper>() {
return this is TypeCheck<TSuper>;
}