What data structure is inside std::map in C++?

前端 未结 6 912
余生分开走
余生分开走 2020-12-03 11:34

I\'m beginner and learning C++ Having hard times to understand std::map concepts, because the code I\'m playing with implies that the map is a search tree, i.e.

6条回答
  •  眼角桃花
    2020-12-03 11:59

    As chris have written, the standard doesn't define the internal structure of the std::map or std::set. It defines the interface and complexity requirements for operations like insertion of an element. Those data structures of course may be implemented as trees. For example the implementation shipped with VisualStudio is based on a red-black tree.

提交回复
热议问题