From 07fa8883ae3ad8a8614eba8eca8b2fda79bc5e30 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Tue, 11 Jan 2022 07:57:50 -0800 Subject: [PATCH] Use `cuda::std::is_arithmetic` in `cudf::is_numeric` trait. (#9996) The current implementation of `cudf::is_numeric` is equivalent to the implementation of `cuda::std::is_arithmetic`. This PR simplifies the implementation in cuDF and aligns it with libcudacxx. Notes: - `bool` returns true from both `(cuda::)std::is_integral` and `(cuda::)std::is_arithmetic`, so `bool` is considered a "numeric" type. This behavior is unchanged. - We must use `cuda::std::is_arithmetic` rather than `std::is_arithmetic` to [support 128-bit integer types](https://github.com/NVIDIA/libcudacxx/blob/05e3bae155a17759bc7fd4d1904b6b5da4c9be51/include/cuda/std/detail/libcxx/include/type_traits#L754-L757) (as we do with `cuda::std::is_integral` in the current implementation) See also: https://en.cppreference.com/w/cpp/types/is_arithmetic Authors: - Bradley Dice (https://github.com/bdice) Approvers: - David Wendt (https://github.com/davidwendt) - Nghia Truong (https://github.com/ttnghia) URL: https://github.com/rapidsai/cudf/pull/9996 --- cpp/include/cudf/utilities/traits.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/include/cudf/utilities/traits.hpp b/cpp/include/cudf/utilities/traits.hpp index d1bd3049ba3..0b3b3a5df76 100644 --- a/cpp/include/cudf/utilities/traits.hpp +++ b/cpp/include/cudf/utilities/traits.hpp @@ -177,7 +177,7 @@ inline bool is_equality_comparable(data_type type) template constexpr inline bool is_numeric() { - return cuda::std::is_integral() or std::is_floating_point::value; + return cuda::std::is_arithmetic(); } struct is_numeric_impl {