mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Update comments
This commit is contained in:
parent
129abf6113
commit
2e6208c754
@ -1027,7 +1027,6 @@ for (it = my_vector.begin(); it != my_vector.end(); ++it) {
|
|||||||
|
|
||||||
// Set
|
// Set
|
||||||
// Sets are containers that store unique elements following a specific order.
|
// 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
|
// Set is a very useful container to store unique values in sorted order
|
||||||
// without any other functions or code.
|
// without any other functions or code.
|
||||||
|
|
||||||
@ -1058,11 +1057,12 @@ cout << ST.size(); // will print the size of set ST
|
|||||||
// Output: 0
|
// Output: 0
|
||||||
|
|
||||||
// NOTE: for duplicate elements we can use multiset
|
// NOTE: for duplicate elements we can use multiset
|
||||||
|
// NOTE: For hash sets, use unordered_set. They are more effecient but
|
||||||
|
// do not preserve order. unordered_set is available since C++11
|
||||||
|
|
||||||
// Map
|
// Map
|
||||||
// Maps store elements formed by a combination of a key value
|
// Maps store elements formed by a combination of a key value
|
||||||
// and a mapped value, following a specific order.
|
// 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>
|
#include<map>
|
||||||
map<char, int> mymap; // Will initialize the map with key as char and value as int
|
map<char, int> mymap; // Will initialize the map with key as char and value as int
|
||||||
@ -1086,6 +1086,8 @@ cout << it->second;
|
|||||||
|
|
||||||
// Output: 26
|
// Output: 26
|
||||||
|
|
||||||
|
// NOTE: For hash maps, use unordered_map. They are more effecient but do
|
||||||
|
// not preserve order. unordered_map is available since C++11.
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
// Logical and Bitwise operators
|
// Logical and Bitwise operators
|
||||||
|
Loading…
Reference in New Issue
Block a user