I am getting template errors when trying to create a vector of unique pointers to an abstract class with friended protected constructor & destructor. Making the constructor & destructor public fixes the issue, but I want only SystemsManager and System's inheritors to be able to call the System constructor. I would rather not have vector to be of raw pointers.
System.h
class System
{
friend class SystemsManager;
protected:
System() = default;
~System() = default;
virtual void init() = 0;
};
SystemsManager.h
class SystemsManager
{
private:
std::vector<std::unique_ptr<System>> mSystems;
};
Aucun commentaire:
Enregistrer un commentaire