If I have an unordered_map<key, someNiceObject>
(note someNiceObject
is not a pointer)
I have an API which inserts a new element, then returns a pointer to someNiceObject
now in the map.
If I perform further insertions into the map, there could be a capacity change. If that happens is the pointer still valid or not?
I tried reading Basic questions: Pointers to objects in unordered_maps (C++), std::unordered_map pointers/reference invalidation and http://eel.is/c++draft/unord.req#9
and couldn't locate the necessary information
Thanks all
edit: it seems that the pointer would be valid (https://www.thecodingforums.com/threads/do-insert-erase-invalidate-pointers-to-elements-values-of-std-unordered_map.961062/)
though would appreciate a second confirmation from someone here on SO.