You can use <type_traits>
(in C++11) to check whether a class is abstract. However, this only checks whether any method is pure virtual. But, you could have other methods which are either not-polymorphic at all, or at least, not pure virtual.
I'd like to check whether a class has only pure-virtual methods. The intention is to enforce a class to be an interface-only class (eg. by static_assert
). There doesn't appear to be a built-in trait for this - am I missing it, or is there some reasonable combination of the existing ones to accomplish this?
Aucun commentaire:
Enregistrer un commentaire