Concept Subspace :: sus :: ptr :: SameOrSubclassOf
template <class T, class U>concept SameOrSubclassOf
requires
std::is_pointer_v<T>
std::is_pointer_v<U>
std::is_convertible_v<T, U>
SameOrSubclassOf<T*, U*>
is true if T
is the same type as U
or
inherits from U
.
This can replace the use of std::is_convertible_v for handling compatible pointers.
The inputs must be pointer types, which helps avoid accidental conversions from arrays, as they are not pointers. Also helps prevent the decay from the array to a pointer before the concept is called.