I have a base class Updater:
class Updater : public std::enable_shared_from_this<Updater>
{
virtual void update(void) = 0;
};
With lots of derivates, most dynamically created, but some statically created. These get registered to perform some batched updates into:
class DispatchGroup {
std::vector<std::shared_ptr<Updater>> m_dispatchList;
};
Given a derivate class:
class UpdaterDerivate : public Updater {...};
How should I create a statically defined instance of UpdaterDerivate which can safely participate in the DispatchGroup::m_dispatchList?
Initialization ordering isn't a problem (DispatchGroups can only be dynamically created), so the concern is how to avoid having m_dispatchList destruction try to destruct (and free) my statically allocated UpdaterDerivates.
Aucun commentaire:
Enregistrer un commentaire