You std::is_base_of<A,B>::valuecan check with C whether the class is a Abase class B. Is it possible to request a compiler for all the base classes of a class
B , for example, something like base_classes_of<B>returning std :: tuple containing all the base classes B?
Is there evtl. non-standard extension in g ++ that can do this?
If this is not possible at all, does anyone know why? Does this sound quite fundamentally a piece of information that the compiler should easily have?
Example:
#include <type_traits>
#include <tuple>
struct A {};
struct B : A {};
static_assert(std::is_base_of<A, B>::value, "A is base of B");
static_assert(! std::is_base_of<B, A>::value, "but B is not base of A");
int main() {}
source
share