lundi 13 juillet 2020

std::is_base_of for a ctor compiling error

I have the following:

class ListableItem { };
class Listable : public ListableItem { };

template<typename T, typename = std::enable_if_t<std::is_base_of<ListableItem, T>::value>>
class A: public AnyClass
{
public:
    explicit A(const std::vector<T> &items) {}
    virtual ~A() {}

    std::vector<T> items;
};

Class A is not compiling whenever I extend it, like:

class B : public A<Listable> {};

I can't use pointers in this case Any clues? Thnks.

Aucun commentaire:

Enregistrer un commentaire