-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_mvmap.cpp
More file actions
45 lines (33 loc) · 788 Bytes
/
Copy pathtest_mvmap.cpp
File metadata and controls
45 lines (33 loc) · 788 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
45
#include "mvmap.h"
#include <iostream>
typedef mongo::multiversion_map<std::string, int> mvmap_type;
void dump_map(mvmap_type &mvmap) {
for (auto i = mvmap.begin(); i != mvmap.end(); i++) {
std::cout << (*i).first << " -> " << (*i).second << ", ";
}
std::cout << std::endl;
}
int main() {
mvmap_type mvmap;
mvmap["a"] = 1;
mvmap["b"] = 2;
mvmap["c"] = 3;
dump_map(mvmap);
mvmap.set_timestamp(3, 4);
mvmap["a"] = 4;
mvmap.set_timestamp(4, 5);
mvmap["b"] = 5;
mvmap.set_timestamp(5, 6);
mvmap["c"] = 6;
dump_map(mvmap);
mvmap.set_timestamp(6, 7);
mvmap["a"] = 7;
mvmap.set_timestamp(6, 8);
mvmap["b"] = 8;
mvmap.set_timestamp(6, 9);
mvmap["c"] = 9;
dump_map(mvmap);
mvmap.set_timestamp(6, 6);
dump_map(mvmap);
return (0);
}