11 #ifdef CK_CODE_GEN_RTC
13 #define CK_BUILTIN_TYPE_TRAIT1(name) \
15 struct name : bool_constant<__##name(T)> \
20 #define CK_BUILTIN_TYPE_TRAIT2(name) \
21 template <class T, class U> \
22 struct name : bool_constant<__##name(T, U)> \
27 #define CK_BUILTIN_TYPE_TRAITN(name) \
28 template <class... Ts> \
29 struct name : bool_constant<__##name(Ts...)> \
33 CK_BUILTIN_TYPE_TRAIT1(is_class);
34 CK_BUILTIN_TYPE_TRAIT1(is_pointer);
35 CK_BUILTIN_TYPE_TRAIT1(is_reference);
36 CK_BUILTIN_TYPE_TRAIT1(is_trivially_copyable);
37 CK_BUILTIN_TYPE_TRAIT1(is_unsigned);
38 CK_BUILTIN_TYPE_TRAIT2(is_base_of);
47 struct remove_cv<const T> : remove_cv<T>
52 struct remove_cv<volatile T> : remove_cv<T>
57 struct remove_reference
62 struct remove_reference<T&>
67 struct remove_reference<T&&>
77 struct remove_pointer<T*>
82 struct remove_pointer<T*
const>
87 struct remove_pointer<T*
volatile>
92 struct remove_pointer<T*
const volatile>
98 constexpr T&& forward(
typename remove_reference<T>::type& t_) noexcept
100 return static_cast<T&&
>(t_);
102 template <
typename T>
103 constexpr T&& forward(
typename remove_reference<T>::type&& t_) noexcept
105 return static_cast<T&&
>(t_);
109 struct is_const :
public integral_constant<bool, false>
113 struct is_const<const T> :
public integral_constant<bool, true>
117 inline constexpr
bool is_const_v = is_const<T>::value;
119 template <
typename T>
120 inline constexpr
bool is_reference_v = is_reference<T>::value;
128 struct remove_const<const T>
133 using remove_const_t =
typename remove_const<T>::type;
135 inline constexpr
bool is_class_v = is_class<T>::value;
138 inline constexpr
bool is_trivially_copyable_v = is_trivially_copyable<T>::value;
142 template <
class T,
class U = T&&>
143 U private_declval(
int);
146 T private_declval(
long);
149 auto declval() noexcept -> decltype(private_declval<T>(0));
155 #include <type_traits>
158 using std::is_base_of;
160 using std::is_class_v;
161 using std::is_const_v;
162 using std::is_pointer;
163 using std::is_reference;
164 using std::is_reference_v;
165 using std::is_trivially_copyable;
166 using std::is_trivially_copyable_v;
167 using std::is_unsigned;
168 using std::remove_const_t;
169 using std::remove_cv;
170 using std::remove_pointer;
171 using std::remove_reference;
175 template <
typename X,
typename Y>
180 template <
typename X>
185 template <
typename X>
204 template <
typename X>
282 template <
typename X,
typename Y>
285 template <
typename X,
typename Y>
288 template <
typename T>
291 template <
typename T>
294 template <
typename T>
297 template <
typename T>
299 template <
typename T>
302 template <
typename T>
305 template <
typename T>
308 template <
typename Y,
typename X,
typename enable_if<sizeof(X) == sizeof(Y),
bool>::type = false>
309 __host__ __device__ constexpr Y
bit_cast(
const X& x)
311 static_assert(__has_builtin(__builtin_bit_cast),
"");
312 static_assert(
sizeof(X) ==
sizeof(Y),
"Do not support cast between different size of type");
314 return __builtin_bit_cast(Y, x);
typename remove_reference< T >::type remove_reference_t
Definition: type.hpp:292
__host__ constexpr __device__ Y bit_cast(const X &x)
Definition: type.hpp:309
typename remove_pointer< T >::type remove_pointer_t
Definition: type.hpp:303
constexpr bool is_pointer_v
Definition: type.hpp:306
constexpr bool is_base_of_v
Definition: type.hpp:286
constexpr bool is_unsigned_v
Definition: type.hpp:289
constexpr bool is_same_v
Definition: type.hpp:283
remove_cv_t< remove_reference_t< T > > remove_cvref_t
Definition: type.hpp:300
typename remove_cv< T >::type remove_cv_t
Definition: type.hpp:298
Definition: integral_constant.hpp:10