I want to have a place to store my objects. A vector is a good choice for this but I also want to pass a pointer to those elements to other objects. The problem is that when I push_back, the vector might invalidate all the references...
Should I use a vector of shared_ptr? And store a shared_ptr in my other objects so when the vector grows, the shared_ptr is still valid? This seems costly because I have many objects to store.
The vector or any container that will contains the object is the person who owns the objects. Now I just want to have a stable reference or something to those elements that I can pass around to other people.