C ++ container iterators

This question may seem lame, but I did not find a clear answer. Can I assume that the iterator returned by the method map find()will point to the same data, even if I add (or delete) other elements to the same map? It is not clear to me if the iterator mappoints to a position in mapor to specific data ...

+3
source share
1 answer

You can continue to use the same iterator after operations insertor erase. The standard says (C ++ 03 standard, section 23.1.2, paragraph 8):

, .

(map, set, multimap, multiset).

+10

Source: https://habr.com/ru/post/1787108/


All Articles