-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmisc.h
More file actions
36 lines (33 loc) · 660 Bytes
/
misc.h
File metadata and controls
36 lines (33 loc) · 660 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
#pragma once
#include <iostream>
#include <sstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#define STR(msg...) \
([&]() { \
std::ostringstream ss; \
ss << msg; \
ss.flush(); \
return ss.str(); \
}())
#define CSTR(msg...) (STR(msg).c_str())
#define PRINT(msg...) \
{ \
std::cout << STR(msg << std::endl); \
}
#define WARNING(msg...) \
{ \
std::cerr << STR("WARNING: " << msg << std::endl); \
}
#define PRINT_ERR(msg...) \
{ \
std::cerr << STR(msg << std::endl); \
}
#define FAIL(msg...) \
{ \
std::cerr << STR("error: " << msg << std::endl); \
fflush(stdout); \
fflush(stderr); \
exit(EXIT_FAILURE); \
}