-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (39 loc) · 1.41 KB
/
main.cpp
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
#include "iostream"
#include "solvers/day1.h"
#include "solvers/day2.h"
#include "solvers/day3.h"
#include "solvers/day4.h"
#include "solvers/day5.h"
#include "solvers/day6.h"
#include "solvers/day7.h"
#include "solvers/day8.h"
#include "solvers/day9.h"
#include "solvers/day11.h"
#include "solvers/day12.h"
#include <chrono>
using namespace std::chrono;
template<typename F, typename ...Args>
auto timeCallVoid(F f, Args ... args){
auto pre = high_resolution_clock::now();
f(std::forward<Args>(args)...);
auto post = high_resolution_clock::now();
return post - pre;
};
int main(){
std::vector<std::pair<int, decltype(high_resolution_clock::now() - high_resolution_clock::now())>> v;
v.emplace_back(1, timeCallVoid(day1::solve));
v.emplace_back(2, timeCallVoid(day2::solve));
v.emplace_back(3, timeCallVoid(day3::solve));
v.emplace_back(4, timeCallVoid(day4::solve));
v.emplace_back(5, timeCallVoid(day5::solve));
v.emplace_back(6, timeCallVoid(day6::solve));
v.emplace_back(7, timeCallVoid(day7::solve));
v.emplace_back(8, timeCallVoid(day8::solve));
v.emplace_back(9, timeCallVoid(day9::solve));
v.emplace_back(11, timeCallVoid(day11::solve));
v.emplace_back(12, timeCallVoid(day12::solve));
std::cout << "DURATIONS (ms)\n";
for (auto &i : v) {
std::cout << "Day " << i.first << ": " << duration_cast<milliseconds>(i.second).count() << '\n';
}
}