3 ms·
>> or some other piece of code is known to keep direct references to the elements that should not be invalidated > In that case, why not store the elements in
by tummulfingur 6y ago
>> or some other piece of code is known to keep direct references to the elements that should not be invalidated
> In that case, why not store the elements in a unique_ptr (and then everything in a vector)?
I recently ended up using std::list<Object*> because of pointer invalidation on vector resize. I see now that using smart pointers would have worked just as well. Thanks.