mardi 18 février 2020

"Undefined class" as argument for is_base_of

class Base {};

template <class T, typename = std::enable_if<std::is_base_of<Base, T>::value>>
class B {};                                       ^^^^^^^^^^ error C2139: 'A': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_base_of'

class A : public Base
{
    B<A> b;
};

Apparently this is not allowed. Is there a workaround, or something I'm forgetting?

Aucun commentaire:

Enregistrer un commentaire