const in map pairs
This commit is contained in:
@@ -23,8 +23,7 @@ text file on which that string occurs (next lecture).
|
||||
std::map<key_type, value_type> var_name
|
||||
In our first two examples above, key type is a string. In the first example, the value type is an int and in
|
||||
the second it is a std::vector<int>.
|
||||
- Entries in maps are pairs:
|
||||
std::pair<const key_type, value_type>
|
||||
- Entries in maps are pairs: std::pair<const key_type, value_type>, or just std::pair<key_type, value_type>.
|
||||
- Map iterators refer to pairs.
|
||||
- Map search, insert and erase are all very fast: O(log n) time, where n is the number of pairs stored in the map.
|
||||
Note: The STL map type has similarities to the Python dictionary, Java HashMap, or a Perl hash, but the
|
||||
|
||||
Reference in New Issue
Block a user