From 3f105bc873517735f01cf8f2f9766204efe91a06 Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Mon, 13 Jan 2025 15:06:29 +0100 Subject: [PATCH] Deprecate thrust::numeric_limits --- thrust/testing/unittest/testframework.h | 15 ++++++++++++--- thrust/testing/unittest/util.h | 4 ++-- thrust/thrust/limits.h | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/thrust/testing/unittest/testframework.h b/thrust/testing/unittest/testframework.h index cd5799e0ca0..9739d602e9e 100644 --- a/thrust/testing/unittest/testframework.h +++ b/thrust/testing/unittest/testframework.h @@ -9,8 +9,11 @@ #include #include +#include + #include #include +#include #include #include #include @@ -199,22 +202,28 @@ class custom_numeric } }; -THRUST_NAMESPACE_BEGIN +namespace std +{ +template <> +struct numeric_limits : numeric_limits +{}; +} // namespace std +_LIBCUDACXX_BEGIN_NAMESPACE_STD template <> struct numeric_limits : numeric_limits {}; +_LIBCUDACXX_END_NAMESPACE_STD +THRUST_NAMESPACE_BEGIN namespace detail { - // For random number generation template <> class integer_traits : public integer_traits_base {}; } // namespace detail - THRUST_NAMESPACE_END using NumericTypes = unittest::type_list< diff --git a/thrust/testing/unittest/util.h b/thrust/testing/unittest/util.h index 39c4ea962e8..7618d02643e 100644 --- a/thrust/testing/unittest/util.h +++ b/thrust/testing/unittest/util.h @@ -26,7 +26,7 @@ typename THRUST_NS_QUALIFIER::detail::disable_if<::cuda::std::is_floating_point< truncate_to_max_representable(std::size_t n) { return static_cast( - THRUST_NS_QUALIFIER::min(n, static_cast(THRUST_NS_QUALIFIER::numeric_limits::max()))); + THRUST_NS_QUALIFIER::min(n, static_cast(::cuda::std::numeric_limits::max()))); } // TODO: This probably won't work for `half`. @@ -34,7 +34,7 @@ template typename ::cuda::std::enable_if_t<::cuda::std::is_floating_point::value, T> truncate_to_max_representable(std::size_t n) { - return THRUST_NS_QUALIFIER::min(static_cast(n), THRUST_NS_QUALIFIER::numeric_limits::max()); + return THRUST_NS_QUALIFIER::min(static_cast(n), ::cuda::std::numeric_limits::max()); } } // namespace unittest diff --git a/thrust/thrust/limits.h b/thrust/thrust/limits.h index b6ea9c0bdf9..54cad7fd1cf 100644 --- a/thrust/thrust/limits.h +++ b/thrust/thrust/limits.h @@ -24,7 +24,7 @@ THRUST_NAMESPACE_BEGIN template -struct numeric_limits : std::numeric_limits +struct CCCL_DEPRECATED_BECAUSE("Use cuda::std::numeric_limits") numeric_limits : std::numeric_limits {}; THRUST_NAMESPACE_END