16template<
bool flag,
typename T,
typename F>
17struct Select {
using Type = T; };
19template<
typename T,
typename F>
20struct Select<false, T, F> {
using Type = F; };
22template<
typename T,
typename U>
27 class B {
char dummy[2]; };
34 static constexpr bool exists =
sizeof(test(make_T())) ==
sizeof(S);
35 static constexpr bool two_way = exists && Conversion<U, T>::exists;
36 static constexpr bool exists_2_way = two_way;
37 static constexpr bool same_type =
false;
41class Conversion<void, void>
44 static constexpr bool exists =
true;
45 static constexpr bool two_way =
true;
46 static constexpr bool exists_2_way = two_way;
47 static constexpr bool same_type =
true;
54 static constexpr bool exists =
true;
55 static constexpr bool two_way =
true;
56 static constexpr bool exists_2_way = two_way;
57 static constexpr bool same_type =
true;
61class Conversion<void, T>
64 static constexpr bool exists =
false;
65 static constexpr bool two_way =
false;
66 static constexpr bool exists_2_way = two_way;
67 static constexpr bool same_type =
false;
71class Conversion<T, void>
74 static constexpr bool exists =
false;
75 static constexpr bool two_way =
false;
76 static constexpr bool exists_2_way = two_way;
77 static constexpr bool same_type =
false;
85 using Pointee = Null_type;
86 static constexpr bool value =
false;
90 struct Pointer_traits<U *>
93 static constexpr bool value =
true;
100 static constexpr bool value =
false;
104 struct Ref_traits<U &>
107 static constexpr bool value =
true;
111 struct Add_ref {
using Type = U &; };
114 struct Add_ref<U &> {
using Type = U; };
118 {
static constexpr bool value =
false; };
120 template<
typename U,
typename F>
121 struct PMF_traits<U F:: *>
122 {
static constexpr bool value =
true; };
126 {
static constexpr bool value =
false; };
129 struct Is_unsigned<unsigned>
130 {
static constexpr bool value =
true; };
133 struct Is_unsigned<unsigned char>
134 {
static constexpr bool value =
true; };
137 struct Is_unsigned<unsigned short>
138 {
static constexpr bool value =
true; };
141 struct Is_unsigned<unsigned long>
142 {
static constexpr bool value =
true; };
145 struct Is_unsigned<unsigned long long>
146 {
static constexpr bool value =
true; };
150 {
static constexpr bool value =
false; };
153 struct Is_signed<signed>
154 {
static constexpr bool value =
true; };
157 struct Is_signed<signed char>
158 {
static constexpr bool value =
true; };
161 struct Is_signed<signed short>
162 {
static constexpr bool value =
true; };
165 struct Is_signed<signed long>
166 {
static constexpr bool value =
true; };
169 struct Is_signed<signed long long>
170 {
static constexpr bool value =
true; };
174 {
static constexpr bool value =
false; };
178 {
static constexpr bool value =
true; };
182 {
static constexpr bool value =
true; };
185 struct Is_int<wchar_t>
186 {
static constexpr bool value =
true; };
190 {
static constexpr bool value =
false; };
193 struct Is_float<float>
194 {
static constexpr bool value =
true; };
197 struct Is_float<double>
198 {
static constexpr bool value =
true; };
201 struct Is_float<long double>
202 {
static constexpr bool value =
true; };
208 using Const_type =
const T;
209 static constexpr bool value =
false;
213 struct Const_traits<const T>
216 using Const_type =
const T;
217 static constexpr bool value =
true;
224 static constexpr bool is_unsigned = TT::Is_unsigned<T>::value;
225 static constexpr bool is_signed = TT::Is_signed<T>::value;
227 static constexpr bool is_int = TT::Is_int<T>::value;
228 static constexpr bool is_float = TT::Is_float<T>::value;
230 static constexpr bool is_pointer = TT::Pointer_traits<T>::value;
231 static constexpr bool is_pointer_to_member = TT::PMF_traits<T>::value;
232 static constexpr bool is_reference = TT::Ref_traits<T>::value;
234 static constexpr bool is_scalar = is_unsigned || is_signed || is_int
235 || is_pointer || is_pointer_to_member || is_reference;
237 static constexpr bool is_fundamental = is_unsigned || is_signed || is_float
238 || Conversion<T, void>::same_type;
240 static constexpr bool is_const = TT::Const_traits<T>::value;
253 static constexpr unsigned long align(
unsigned long address)
254 {
return (address +
alignof(T) - 1UL) & ~(
alignof(T) - 1UL); }
256 using Param_type =
typename Select<is_scalar, T, typename TT::Add_ref<typename TT::Const_traits<T>::Const_type>::Type>::Type;
258 using Pointee_type =
typename TT::Pointer_traits<T>::Pointee;
259 using Referee_type =
typename TT::Ref_traits<T>::Referee;
260 using Non_const_type =
typename TT::Const_traits<T>::Type;
261 using Const_type =
typename TT::Const_traits<T>::Const_type;