Let's say I have some templated class depending on type T
. T
could be almost anything: int
, int*
, pair <int, int>
or struct lol
; it cannot be void
, a reference or anything cv-qualified though. For some optimization I need to know if I can subclass T
. So, I'd need some trait type is_subclassable
, determined as a logical combination of basic traits or through some SFINAE tricks.
In the original example, int
and int*
are not subclassable, while pair <int, int>
and struct lol
are.
EDIT: As litb pointed out below, unions are also not subclassable and T
can be a union type as well.
How do I write the trait type I need?