-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtools.h
52 lines (43 loc) · 792 Bytes
/
tools.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
46
47
48
49
50
51
52
#ifndef TOOLS_H
#define TOOLS_H
//If
template<bool Condition, typename TrueResult, typename FalseResult>
struct IF;
template<typename TrueResult, typename FalseResult>
struct IF<true, TrueResult, FalseResult>
{
typedef TrueResult result;
};
template<typename TrueResult, typename FalseResult>
struct IF<false, TrueResult, FalseResult>
{
typedef FalseResult result;
};
//Is same
template<typename A, typename B>
struct is_same
{
static bool const result = false;
};
template<typename A>
struct is_same<A, A>
{
static bool const result = true;
};
//Constant
template<int Value>
struct constant
{
static int const value = Value;
};
//True
struct _true
{
static bool const result = true;
};
//False
struct _false
{
static bool const result = false;
};
#endif