lundi 8 juillet 2019

std::is_base_of for template classes (non-type template parameters)

I'm trying to implement an extension for std::is_base_of for templated classes, such that if I have the following:

template <typename X, typename Y, int Z> class A {};

template <typename X> class B : public A<X, char, 2> {};

I can use something like

std::is_base_of_ext<A, B<int>>

to statically check that An is a base class from B, independently of specific template parameters and the way B specializes from A.

stackoverflow.com/questions/34672441/stdis-base-of-for-template-classes provides a very nice solution to this, but it only works with type template parameters; can it also be made to work with non-type parameters?

Thank you very much!

Aucun commentaire:

Enregistrer un commentaire