1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-11 09:14:39 +02:00

Add comments about unordered_map and unordered_set

This commit is contained in:
Ankush Agarwal
2018-10-22 08:44:21 -07:00
committed by GitHub
parent 88e24ff1a4
commit 129abf6113

View File

@@ -1027,6 +1027,7 @@ for (it = my_vector.begin(); it != my_vector.end(); ++it) {
// Set
// Sets are containers that store unique elements following a specific order.
// For hash sets, use unordered_set. They are more effecient but do not preserve order.
// Set is a very useful container to store unique values in sorted order
// without any other functions or code.
@@ -1061,6 +1062,7 @@ cout << ST.size(); // will print the size of set ST
// Map
// Maps store elements formed by a combination of a key value
// and a mapped value, following a specific order.
// For hash maps, use unordered_map. They are more effecient but do not preserve order.
#include<map>
map<char, int> mymap; // Will initialize the map with key as char and value as int