Swimmer

[C++ STL] map 본문

개념공부/C, C++

[C++ STL] map

Zach Choi 2023. 1. 16. 21:39
  • std::map

Maps are associative containers that store elements formed by a combination of a key value and mapped value.

The key values are generally used to sort and uniquely identify the elements

The mapped values store the content associated to this key.

The types of key and mapped value may differ. and both are grouped together by pair type

typedef pair<const Key, T> value_type;

Internally, the elements in a map are always sorted by its key

Maps are typically implemented as binary search trees

 

  • Properties

Associative : Elements in containers are reference by their key, not by their absolute position in the container

Ordered : The elements in the container follow order at all times

Unique keys : No two elements in the container can have equivalent keys

 

 

Reference : https://cplusplus.com/reference/map/map/

'개념공부 > C, C++' 카테고리의 다른 글

Bitwise Operation, Operator (비트연산)  (0) 2023.01.17
[C++ STL] unordered_map  (0) 2023.01.16
[LeetCode] 1. Two Sum  (1) 2023.01.09
[LeetCode] 1030. Matrix Cells in Distance Order, C++  (0) 2023.01.09
[C++] Unordered Map (작성 중)  (0) 2023.01.08
Comments