There are two STL vectors, one with objects and second with pointers to objects.
v_objects = [obj1, obj2, obj3, obj4]
v_ptr = [ptr_to_obj1, ptr_to_obj2, ptr_to_obj3, ptr_to_obj4]
Vector v_ptr is used to sort elements in v_objects. Let's say that something is added to v_objects so it looks like:
v_objects = [obj1, obj2, obj3, obj4, obj5]
Let's say that v_objects are after insertion reallocated somewhere else and pointers in v_ptr are invalid. Now I want to sort objects using their pointers in v_ptr, but they are invalid. Is it somehow possible to create some clever pointers which point to the same object as they were before reallocation (using stl::vector)?