-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
75 lines (59 loc) · 1.48 KB
/
main.cpp
File metadata and controls
75 lines (59 loc) · 1.48 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
64
65
66
67
68
69
70
71
72
73
74
75
//
// Created by eugene on 28.9.2017
//
#ifdef _GTEST
#include <gtest/gtest.h>
#include <type_traits>
#endif
#include "FlattenTuple.h"
#include "Promise.h"
#include <vector>
#include "Future.h"
#include <chrono>
#include "ThreadPool.h"
using namespace std;
template<class Ch, class Tr, class Tuple, std::size_t... Is>
void print_tuple_impl(std::basic_ostream<Ch,Tr>& os,
const Tuple & t,
std::index_sequence<Is...>)
{
((os << (Is == 0? "" : ", ") << std::get<Is>(t)), ...);
}
template<class Ch, class Tr, typename T>
decltype(auto) operator<<(std::basic_ostream<Ch, Tr>& os,
const vector<T>& t)
{
os << "[ ";
for(auto &i: t){
os << i ;
if(i != t.back())
os << ", ";
}
return os << "]";
}
template<class Ch, class Tr, class... Args>
decltype(auto) operator<<(std::basic_ostream<Ch, Tr>& os,
const std::tuple<Args...>& t)
{
os << "(";
print_tuple_impl(os, t, std::index_sequence_for<Args...>{});
return os << ")";
}
int main(int argc, char *argv[]) {
/*std::vector<int> b {1 , 2 , 3};
auto f = [](int &a){
a += 2;
};
ThreadPool t(3);
t.parallel(b.begin(), b.end(), f);
std::this_thread::sleep_for(1s);
for(int i = 0; i < b.size();i++) {
std::cout << b[i] << " ";
}*/
return 0;/*
#ifdef _GTEST
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
#endif
return 0;*/
}