-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathcustomize-dump.cpp
More file actions
36 lines (26 loc) · 819 Bytes
/
customize-dump.cpp
File metadata and controls
36 lines (26 loc) · 819 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
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include "../cpp-dump.hpp"
namespace cp = cpp_dump;
void my_func() {
std::map<int, int> my_map{{2, 6}, {4, 6}, {5, 3}};
std::set<char> my_set{'A', 'p', 'p', 'l', 'e'};
cpp_dump(my_map);
cpp_dump(my_set);
}
int main() {
std::clog << std::endl;
std::vector<std::vector<int>> my_vector{{3, 5, 8, 9, 7}, {9, 3, 2, 3, 8}};
std::clog << "// Print the filename and line instead of [dump]" << std::endl;
CPP_DUMP_SET_OPTION(log_label_func, cp::log_label::filename());
cpp_dump(my_vector);
my_func();
std::clog << std::endl;
std::clog << "// Print along with the function name" << std::endl;
CPP_DUMP_SET_OPTION(log_label_func, cp::log_label::filename(true));
cpp_dump(my_vector);
my_func();
std::clog << std::endl;
}