There is a fundamental difference between std::vector<someType> myVector and std::vector<someType*> myVector . A version other than pointers actually owns and stores data. This means that after making the task, changes to the source variable will not lead to a change in your vector (deep copy).
In the version of the pointer, the storage is external to the vector. This means that changes in the original will lead to a change in your vector (small copy). This is another blow to the effect.
Since the repository is external to your vector, you are responsible for making the original fall longer than your vector. Otherwise, bad things will happen. This can be mitigated with std::shared_ptr , but you are still imposing the same memory.
So the question you need to ask is whether you need a shallow copy or a deep copy.
Also std::move save a copy only if the data is stored outside a struct (e.g. stl-container), otherwise you will need to move std::unique_ptr<someType> to save the copy.
doron source share