The short answer is no.
Long answer:
std::vector<std::shared_ptr<Object>>and std::vector<std::shared_ptr<SpecializedObject>>- completely different and unrelated animals, and you cannot cast them from one type to another. You have to iterate over the vector and create a new one.
Hint: you can still use static_pointer_castto indicate pointers during iteration (if you know what you are doing, of course).
source
share