-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdef.h
35 lines (32 loc) · 1.23 KB
/
def.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
#pragma once
#include <cassert>
#include <iostream>
#include <limits>
#include <random>
#include <vector>
#include <functional>
// The random seed used in debug and release mode
extern const size_t rand_seed;
extern std::mt19937_64 engine;
#define INF std::numeric_limits<double>::infinity()
#define TODO \
{ \
std::cerr << "TODO assertion" << endl; \
std::cerr << "\tFile: " << __FILE__ << endl; \
std::cerr << "\tLine: " << __LINE__ << endl; \
std::cerr << "\tFunc: " << __func__ << endl; \
exit(EXIT_FAILURE); \
}
#ifdef MYDEBUG
#define MYASSERT(x) \
if (!(x)) \
{ \
std::cerr << "Assertion failed: " << #x << std::endl; \
std::cerr << "\tFile: " << __FILE__ << endl; \
std::cerr << "\tLine: " << __LINE__ << endl; \
std::cerr << "\tFunc: " << __func__ << endl; \
exit(EXIT_FAILURE); \
}
#else
#define MYASSERT(x) assert(x)
#endif