25 #include <cuda/std/type_traits>
27 namespace CUDF_EXPORT
cudf {
36 template <
typename...>
50 #define CUDF_ENABLE_IF(...) cuda::std::enable_if_t<(__VA_ARGS__)>* = nullptr
53 template <
typename L,
typename R>
54 using less_comparable = decltype(cuda::std::declval<L>() < cuda::std::declval<R>());
57 template <
typename L,
typename R>
61 template <
typename L,
typename R>
65 template <
typename L,
typename R,
typename =
void>
66 struct is_relationally_comparable_impl : cuda::std::false_type {};
68 template <
typename L,
typename R>
69 struct is_relationally_comparable_impl<L,
71 void_t<less_comparable<L, R>, greater_comparable<L, R>>>
72 : cuda::std::true_type {};
74 template <
typename L,
typename R,
typename =
void>
75 struct is_equality_comparable_impl : cuda::std::false_type {};
77 template <
typename L,
typename R>
82 template <
typename AlwaysVoid,
typename... Ts>
83 struct has_common_type_impl : cuda::std::false_type {};
85 template <
typename... Ts>
86 struct has_common_type_impl<
void_t<cuda::std::common_type_t<Ts...>>, Ts...> : cuda::std::true_type {
91 template <
typename... Ts>
95 template <
typename... Ts>
100 using is_timestamp_t = cuda::std::disjunction<cuda::std::is_same<cudf::timestamp_D, T>,
101 cuda::std::is_same<cudf::timestamp_h, T>,
102 cuda::std::is_same<cudf::timestamp_m, T>,
103 cuda::std::is_same<cudf::timestamp_s, T>,
104 cuda::std::is_same<cudf::timestamp_ms, T>,
105 cuda::std::is_same<cudf::timestamp_us, T>,
106 cuda::std::is_same<cudf::timestamp_ns, T>>;
109 template <
typename T>
110 using is_duration_t = cuda::std::disjunction<cuda::std::is_same<cudf::duration_D, T>,
111 cuda::std::is_same<cudf::duration_h, T>,
112 cuda::std::is_same<cudf::duration_m, T>,
113 cuda::std::is_same<cudf::duration_s, T>,
114 cuda::std::is_same<cudf::duration_ms, T>,
115 cuda::std::is_same<cudf::duration_us, T>,
116 cuda::std::is_same<cudf::duration_ns, T>>;
130 template <
typename L,
typename R>
133 return detail::is_relationally_comparable_impl<L, R>::value;
157 template <
typename L,
typename R>
160 return detail::is_equality_comparable_impl<L, R>::value;
179 template <
typename T>
182 return cuda::std::is_arithmetic<T>();
209 template <
typename T>
212 return cuda::std::is_integral_v<T> and not cuda::std::is_same_v<T, bool>;
234 template <
typename T>
237 return cuda::std::is_signed_v<T>;
258 template <
typename T>
261 return cuda::std::is_unsigned_v<T>;
281 template <
typename Iterator>
284 return cuda::std::is_signed_v<typename cuda::std::iterator_traits<Iterator>::value_type>;
294 template <
typename T>
297 return cuda::std::is_integral_v<T>;
318 template <
typename T>
321 return cuda::std::is_integral_v<T> and not cuda::std::is_same_v<T, bool>;
342 template <
typename T>
345 return cudf::is_numeric<T>() and not cuda::std::is_same_v<T, bool>;
366 template <
typename T>
369 return cuda::std::is_floating_point_v<T>;
390 template <
typename T>
393 return cuda::std::is_same_v<cuda::std::remove_cv_t<T>, std::byte>;
403 template <
typename T>
406 return cuda::std::is_same_v<T, bool>;
425 template <
typename T>
449 template <
typename T>
452 return cuda::std::is_same_v<numeric::decimal32, T> ||
453 cuda::std::is_same_v<numeric::decimal64, T> ||
454 cuda::std::is_same_v<numeric::decimal128, T> ||
455 cuda::std::is_same_v<numeric::fixed_point<int32_t, numeric::Radix::BASE_2>, T> ||
456 cuda::std::is_same_v<numeric::fixed_point<int64_t, numeric::Radix::BASE_2>, T> ||
457 cuda::std::is_same_v<numeric::fixed_point<__int128_t, numeric::Radix::BASE_2>, T>;
476 template <
typename T>
500 template <
typename T>
503 return is_duration<T>() || is_timestamp<T>();
530 template <
typename T>
533 return cudf::is_numeric<T>() or cudf::is_chrono<T>() or cudf::is_boolean<T>() or
544 template <
typename T>
547 return cuda::std::is_same_v<dictionary32, T>;
568 template <
typename T>
573 return cudf::is_numeric<T>() || cudf::is_chrono<T>() || cudf::is_fixed_point<T>();
601 template <
typename T>
604 return cuda::std::is_same_v<T, cudf::string_view> or
605 cuda::std::is_same_v<T, cudf::dictionary32> or cuda::std::is_same_v<T, cudf::list_view> or
606 cuda::std::is_same_v<T, cudf::struct_view>;
634 template <
typename T>
637 return cuda::std::is_same_v<T, cudf::list_view> || cuda::std::is_same_v<T, cudf::struct_view>;
668 template <
typename From,
typename To>
673 template <
typename Duration1,
typename Duration2>
675 : cuda::std::is_convertible<typename cudf::detail::time_point<Duration1>::duration,
676 typename cudf::detail::time_point<Duration2>::duration> {};
一个非拥有、不可变的设备数据视图,是一个表示 UTF-8 的变长字符数组...
不同分辨率的 int32_t 和 int64_t 持续时间的具体类型定义。
bool is_dictionary(data_type type)
指示类型是否为字典数据类型。
constexpr bool is_byte()
指示 T 是否为 std::byte 类型。
bool is_duration(data_type type)
指示类型是否为持续时间数据类型。
bool is_numeric(data_type type)
指示类型是否为数字数据类型。
bool is_integral(data_type type)
指示类型是否为整型数据类型。
typename detail::has_common_type_impl< void, Ts... >::type has_common_type
检查类型是否具有通用类型。
bool is_equality_comparable(data_type type)
检查数据类型是否支持相等性比较。
bool is_index_type(data_type type)
指示类型是否为索引类型。
decltype(cuda::std::declval< L >() > cuda::std::declval< R >()) greater_comparable
检查两个类型是否可以使用大于运算符(即 >)进行比较。
bool is_numeric_not_bool(data_type type)
指示类型是否为数字数据类型但不是 BOOL8。
bool is_relationally_comparable(data_type type)
检查数据类型是否支持关系比较。
decltype(cuda::std::declval< L >()==cuda::std::declval< R >()) equality_comparable
检查两个类型是否可以使用相等运算符(即 ==)进行比较。
cuda::std::disjunction< cuda::std::is_same< cudf::duration_D, T >, cuda::std::is_same< cudf::duration_h, T >, cuda::std::is_same< cudf::duration_m, T >, cuda::std::is_same< cudf::duration_s, T >, cuda::std::is_same< cudf::duration_ms, T >, cuda::std::is_same< cudf::duration_us, T >, cuda::std::is_same< cudf::duration_ns, T > > is_duration_t
检查类型是否为持续时间类型。
bool is_boolean(data_type type)
指示类型是否为布尔数据类型。
bool is_bit_castable(data_type from, data_type to)
指示 from 是否可按位转换为 to。
bool is_compound(data_type type)
指示类型的元素是否为复合类型。
constexpr bool is_rep_layout_compatible()
指示 T 是否与其“表示”类型布局兼容。
bool is_signed(data_type type)
指示类型是否为有符号数字数据类型。
bool is_nested(data_type type)
指示类型是否为嵌套类型。
decltype(cuda::std::declval< L >()< cuda::std::declval< R >()) less_comparable
检查两个类型是否可以使用小于运算符(即 <)进行比较。
cuda::std::disjunction< cuda::std::is_same< cudf::timestamp_D, T >, cuda::std::is_same< cudf::timestamp_h, T >, cuda::std::is_same< cudf::timestamp_m, T >, cuda::std::is_same< cudf::timestamp_s, T >, cuda::std::is_same< cudf::timestamp_ms, T >, cuda::std::is_same< cudf::timestamp_us, T >, cuda::std::is_same< cudf::timestamp_ns, T > > is_timestamp_t
检查类型是否为时间戳类型。
void void_t
将任意类型序列映射到 void 类型的实用元函数。
bool is_timestamp(data_type type)
指示类型是否为时间戳数据类型。
bool is_floating_point(data_type type)
指示类型是否为浮点数据类型。
bool is_unsigned(data_type type)
指示类型是否为无符号数字数据类型。
constexpr bool has_common_type_v
has_common_type<>::value 的辅助变量模板。
bool is_integral_not_bool(data_type type)
指示类型是否为整型数据类型且不是 BOOL8。
bool is_chrono(data_type type)
指示类型是否为 chrono 数据类型。
bool is_fixed_point(data_type type)
指示类型是否为定点数据类型。
bool is_fixed_width(data_type type)
指示类型的元素是否具有固定宽度。
constexpr CUDF_HOST_DEVICE bool is_signed_iterator()
指示迭代器值类型是否为无符号类型。
int32_t 和 int64_t 时间戳在不同分辨率下的具体类型定义,作为持续时间...
time_point< Duration > timestamp
不同分辨率下 time_point 列的包装器。
#define CUDF_HOST_DEVICE
指示函数或方法可在主机和设备上使用。