-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasics.cpp
More file actions
63 lines (51 loc) · 1.02 KB
/
Basics.cpp
File metadata and controls
63 lines (51 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* \file Basics.cpp
* \brief
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
#include <Stl.h>
//--------------------------------------------------------------------------------------------------
int main(int, char **)
{
std::multimap<char, int> mmapOfPos
{
{'t', 0},
{'h', 1},
{'i', 2},
{'s', 3},
{'i', 5},
{'s', 6},
{'i', 8}
};
mmapOfPos.insert( std::pair<char, int>('t', 9) );
// Iterating over the multimap using iterator
for (auto it = mmapOfPos.begin(); it != mmapOfPos.end(); it++) {
std::cout << it->first << " :: " << it->second << std::endl;
}
std::cout << std::endl << std::endl;
// Iterating over multimap using range based loop
for (auto &elem : mmapOfPos) {
std::cout << elem.first << " :: " << elem.second << std::endl;
}
return 0;
}
//-------------------------------------------------------------------------------------------------
#if OUTPUT
h :: 1
i :: 2
i :: 5
i :: 8
s :: 3
s :: 6
t :: 0
t :: 9
h :: 1
i :: 2
i :: 5
i :: 8
s :: 3
s :: 6
t :: 0
t :: 9
#endif