-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.h
45 lines (40 loc) · 765 Bytes
/
utils.h
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
#ifndef UPDATE_FIREWALLS__UTILS_H
#define UPDATE_FIREWALLS__UTILS_H
#include <iostream>
#include <ranges>
#include <string>
#include <vector>
template<typename T>
int fail(const T& t)
{
std::cerr << t;
return EXIT_FAILURE;
}
template<typename T, typename... Args>
int fail(const T& t, const Args&... args)
{
std::cerr << t;
return fail(args...);
}
template<typename T>
void info(const T& t)
{
std::cout << t;
}
template<typename T, typename... Args>
void info(const T& t, const Args&... args)
{
std::cout << t;
info(args...);
}
template<typename T>
void info(const std::vector<T>& t)
{
info("[ \t");
for (const T& val : t)
{
info("\"", val, "\", ");
}
info("] \n");
}
#endif // UPDATE_FIREWALLS__UTILS_H