Are there any guarantees regarding the location of the std :: map repository?

Are there any guarantees regarding the layout of std::map ? I know that std::vector guaranteed by the standard that all objects sequentially start with *vector.begin() , is there a similar guarantee regarding std::map ?

+4
source share
1 answer

std::map usually implemented as a Red-Black tree. Nodes are allocated from the heap as necessary, so they are likely to fall into random places in memory. More formally, there is no layout guarantee in the standard.

+5
source

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


All Articles