I have a std::vector
containing a lot of elements. As the vector is huge, I store pointers to some specific elements in another vector, to be able to access them faster. But as the vector grows, sometimes its internal container gets reallocated, causing all my pointers to become invalid.
Is there a way to know when this happens? This way I can update the pointers in the other list.