How are keys stored and searched in a STL std::map
? What is the data structure used to store keys (or values also) in map and what algorithm is used to search the keys in std::map
?
Asked
Active
Viewed 87 times
-3

AbcAeffchen
- 14,400
- 15
- 47
- 66

Sulla
- 7,631
- 9
- 45
- 71
-
[What is the map data structure in C++](http://stackoverflow.com/q/12207634) – Bernhard Barker Mar 24 '14 at 09:09
-
1-1 "This question does not show any research effort." – Ali Mar 24 '14 at 11:19
1 Answers
1
From cppreference:
Maps are typically implemented as binary search trees.
By default less<T>
is used to compare keys, but you can specify your custom compare function for that as template parameter.

Vladimir
- 170,431
- 36
- 387
- 313