-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (33 loc) · 801 Bytes
/
main.cpp
File metadata and controls
44 lines (33 loc) · 801 Bytes
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
/* Unit tests */
#include "./tests/unit.h"
/* Speed tests */
#include "./tests/speed.h"
/* Extra tests */
#include "./tests/extra.h"
int main() {
//unit();
//speed();
//extra();
typedef rbmap<char, int> map;
typedef rbmultimap<char, int> multimap;
map m;
m['z'] = 1;
m.erase('z');
std::string a = "abracadabra";
for (int i = 0; i < a.size(); i++) {
m[a.at(i)]++;
}
for (map::iterator it = m.begin(); it != m.end(); it++) {
std::cout << it->first << " -> " << it->second << std::endl;
}
std::cout << std::endl;
multimap mm;
for (int i = 0; i < a.size(); i++) {
mm.insert(std::pair<char, int>(a.at(i), i));
}
for (multimap::iterator mit = mm.begin(); mit != mm.end(); mit++) {
std::cout << mit->first << " -> " << mit->second << std::endl;
}
return 0;
return 0;
}