UdonLibrary 1.0.0
機械システム研究部 C++ ライブラリ
読み取り中…
検索中…
一致する文字列を見つけられません
Typedef.hpp
[詳解]
1//
2// C++11 での型定義の簡略化
3//
4// Copyright (c) 2022-2024 udonrobo
5//
6
7
8#pragma once
9
11#include <type_traits>
12
13namespace Udon
14{
15 namespace Traits
16 {
17
18 template <typename T>
19 using RemoveConstT = typename std::remove_const<T>::type;
20
21 template <typename T>
22 using RemoveVolatileT = typename std::remove_volatile<T>::type;
23
24 template <typename T>
25 using RemoveReferenceT = typename std::remove_reference<T>::type;
26
27 template <typename T>
29
30 template <typename T>
31 using IsBool = std::is_same<T, bool>;
32
33 template <typename T>
34 using IsIntegral = std::is_integral<T>;
35
36 template <typename T>
37 using IsIntegralNotBool = std::integral_constant<bool, IsIntegral<T>::value and not IsBool<T>::value>;
38
39 template <typename T>
40 using IsFloatingPoint = std::is_floating_point<T>;
41
42 template <typename T>
43 using IsArithmetic = std::is_arithmetic<T>;
44
45 template <typename T>
46 using IsScalar = std::is_scalar<T>;
47
48 template <typename T>
49 using IsEnum = std::is_enum<T>;
50
51 template <typename T>
52 using IsArray = std::is_array<T>;
53
54 template <typename T>
55 using DecayT = typename std::decay<T>::type;
56
57 template <typename T>
58 using IsCString = std::is_same<DecayT<T>, const char*>;
59
60 } // namespace Traits
61
62 namespace Traits
63 {
64
65 template <bool Test, typename T = void>
66 using EnableIfT = typename std::enable_if<Test, T>::type;
67
68 template <bool Test>
70
71 template <bool Test, typename T = void>
72 using DisableIfT = typename std::enable_if<not Test, T>::type;
73
74 template <bool Test>
76
80 template <bool Test>
82
86 template <bool Test>
88
89 } // namespace Traits
90} // namespace Udon
91
92#ifndef __cpp_lib_void_t
93namespace std
94{
95 template <typename...>
96 using void_t = void;
97}
98#endif
DisableIfT< not Test, std::nullptr_t > DisableIfNullptrT
Definition Typedef.hpp:87
std::is_enum< T > IsEnum
Definition Typedef.hpp:49
RemoveConstT< RemoveVolatileT< RemoveReferenceT< T > > > RemoveCVRefT
Definition Typedef.hpp:28
std::is_scalar< T > IsScalar
Definition Typedef.hpp:46
typename std::enable_if< Test, T >::type EnableIfT
Definition Typedef.hpp:66
typename std::enable_if< not Test, T >::type DisableIfT
Definition Typedef.hpp:72
std::is_arithmetic< T > IsArithmetic
Definition Typedef.hpp:43
DisableIfT< Test, void > DisableIfVoidT
Definition Typedef.hpp:75
typename std::decay< T >::type DecayT
Definition Typedef.hpp:55
std::is_integral< T > IsIntegral
Definition Typedef.hpp:34
std::is_floating_point< T > IsFloatingPoint
Definition Typedef.hpp:40
EnableIfT< Test, std::nullptr_t > EnableIfNullptrT
Definition Typedef.hpp:81
typename std::remove_volatile< T >::type RemoveVolatileT
Definition Typedef.hpp:22
EnableIfT< Test, void > EnableIfVoidT
Definition Typedef.hpp:69
std::is_same< DecayT< T >, const char * > IsCString
Definition Typedef.hpp:58
typename std::remove_reference< T >::type RemoveReferenceT
Definition Typedef.hpp:25
std::integral_constant< bool, IsIntegral< T >::value and not IsBool< T >::value > IsIntegralNotBool
Definition Typedef.hpp:37
std::is_same< T, bool > IsBool
Definition Typedef.hpp:31
typename std::remove_const< T >::type RemoveConstT
Definition Typedef.hpp:19
std::is_array< T > IsArray
Definition Typedef.hpp:52
Definition Bit.hpp:12
Definition Typedef.hpp:94
void void_t
Definition Typedef.hpp:96