-3

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?

AbcAeffchen
  • 14,400
  • 15
  • 47
  • 66
Sulla
  • 7,631
  • 9
  • 45
  • 71

1 Answers1

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