Skip to content

Commit

Permalink
Deprecate thrust::null_type (#3367)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber authored Jan 14, 2025
1 parent daab0a4 commit 0e63552
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions thrust/testing/tuple.cu
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ DECLARE_UNITTEST(TestTupleCTAD);
#endif // _CCCL_STD_VER >= 2017

// Ensure that we are backwards compatible with the old thrust::tuple implementation
_CCCL_SUPPRESS_DEPRECATED_PUSH
static_assert(
thrust::tuple_size<thrust::tuple<thrust::null_type,
thrust::null_type,
Expand Down Expand Up @@ -625,3 +626,4 @@ static_assert(
static_assert(
thrust::tuple_size<thrust::tuple<int, int, int, int, int, int, int, int, int, thrust::null_type>>::value == 9, "");
static_assert(thrust::tuple_size<thrust::tuple<int, int, int, int, int, int, int, int, int, int>>::value == 10, "");
_CCCL_SUPPRESS_DEPRECATED_POP
8 changes: 7 additions & 1 deletion thrust/thrust/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@
THRUST_NAMESPACE_BEGIN

// define null_type for backwards compatibility
struct null_type
struct CCCL_DEPRECATED_BECAUSE("Please remove null_type from parameters to tuple<...>") null_type
{};

_CCCL_SUPPRESS_DEPRECATED_PUSH

_CCCL_HOST_DEVICE inline bool operator==(const null_type&, const null_type&)
{
return true;
Expand Down Expand Up @@ -77,6 +79,8 @@ _CCCL_HOST_DEVICE inline bool operator>(const null_type&, const null_type&)
return false;
}

_CCCL_SUPPRESS_DEPRECATED_POP

/*! \addtogroup utility
* \{
*/
Expand Down Expand Up @@ -176,6 +180,7 @@ using _CUDA_VSTD::tie;
THRUST_NAMESPACE_END

_LIBCUDACXX_BEGIN_NAMESPACE_STD
_CCCL_SUPPRESS_DEPRECATED_PUSH

template <>
struct tuple_size<tuple<THRUST_NS_QUALIFIER::null_type,
Expand Down Expand Up @@ -284,4 +289,5 @@ struct tuple_size<tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, THRUST_NS_QUALIFIER:
: tuple_size<tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8>>
{};

_CCCL_SUPPRESS_DEPRECATED_POP
_LIBCUDACXX_END_NAMESPACE_STD

0 comments on commit 0e63552

Please sign in to comment.