-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathT.h
65 lines (51 loc) · 1.08 KB
/
T.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
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
/*
* 文件: M.h
* 作者: Legion
* 更新时间: 2023 年 11 月 18 日
*
* 介绍:这是 H3 头文件库的 模板 部分
*
*/
#include "I.h"
#if M_CONFIG_CPP == M_TRUE
template<typename T>
inline cstring_t T_name_of() {
return "unkown type";
}
#define T_name_set(type, name) \
\
template<>\
inline cstring_t T_name_of<type>() {\
return (cstring_t) M_STR(name);\
}
#define T_name_set_default(type) T_name_set(type, type)
T_name_set_default(i8)
T_name_set_default(i16)
T_name_set_default(i32)
T_name_set_default(i64)
template<typename T1, typename T2>
struct T_is_same {
bool value = false;
};
template<typename T1>
struct T_is_same<T1, T1> {
bool value = true;
};
template<bool Exp, typename T1, typename T2>
struct T_if{
using type = T2;
};
template<typename T1, typename T2>
struct T_if<true, T1, T2>{
using type = T1;
};
template<bool Exp, typename T1>
struct T_if<Exp, T1, void>{
using type = void;
};
template<typename T1>
struct T_if<true, T1, void>{
using type = T1;
};
#endif