I have vector which holds a set of shared pointers:
std::vector<std::shared_ptr<Derived>> originalVector;
At some point it implicitly casted to Base shared pointers, it looks like:
std::vector<std::shared_ptr<Base>>* castedVector;
How to add an Derived item to casted vector? Apparently I can emplace an empty std::shared_ptr
into it, does this new shared pointer know anything about type it holds, can it create an object of this type?
Aucun commentaire:
Enregistrer un commentaire