-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint.h
More file actions
41 lines (35 loc) · 1.03 KB
/
print.h
File metadata and controls
41 lines (35 loc) · 1.03 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
#include <iostream>
#include <vector>
void print() {
std::cout << std::endl;
}
// template <typename T, size_t N, typename ... Strings>
// void print(const T (&arr)[N], const Strings&... rest);
template <typename T, typename... Strings>
void print(const std::vector<T> v, const Strings &...rest);
template<typename First, typename ... Strings>
void print(First arg, const Strings&... rest) {
std::cout << arg << " ";
print(rest...);
}
// template <typename T, size_t N, typename ... Strings>
// void print(const T (&arr)[N], const Strings&... rest) {
// std::cout << "[ ";
// for (auto i : arr) {
// std::cout << i << ", ";
// }
// std::cout << "] ";
// print(rest...);
// }
template <typename T, typename ... Strings>
void print(const std::vector<T> v, const Strings&... rest) {
std::cout << "[";
size_t vsize = v.size();
for (size_t i = 0; i < vsize; i++) {
std::cout << v[i];
if (i < vsize - 1)
std::cout << ", ";
}
std::cout << "] ";
print(rest...);
}