Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Apr 25, 2024
1 parent f5b29c2 commit ec4e698
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions thrust/thrust/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,34 @@ struct tuple : public _CUDA_VSTD::tuple<Ts...>

#if defined(_CCCL_COMPILER_MSVC_2017)
// MSVC cannot pull in the converting constructor for whatever reason
template <class TupleLike,
_CUDA_VSTD::__enable_if_t<_CUDA_VSTD::__tuple_constructible<TupleLike, super_t>::value, int> = 0,
_CUDA_VSTD::__enable_if_t<!_CUDA_VSTD::__tuple_convertible<TupleLike, super_t>::value, int> = 0>
_CCCL_HOST_DEVICE _CCCL_CONSTEXPR_CXX14 tuple(TupleLike&& other)
: super_t(_CUDA_VSTD::forward<TupleLike>(other))
template <class _Tuple>
using __tuple_like_constraints = typename super_t::__tuple_like_constraints<_Tuple>;

template <class... _Args>
struct _PackExpandsToThisTuple : false_type
{};

template <class _Arg>
struct _PackExpandsToThisTuple<_Arg> : _CUDA_VSTD::is_same<_CUDA_VSTD::__remove_cvref_t<_Arg>, tuple>
{};

template <class _Tuple,
class _Constraints = __tuple_like_constraints<_Tuple>,
_CUDA_VSTD::__enable_if_t<!_PackExpandsToThisTuple<_Tuple>::value, int> = 0,
_CUDA_VSTD::__enable_if_t<!_LIBCUDACXX_TRAIT(_CUDA_VSTD::is_lvalue_reference, _Tuple), int> = 0,
_CUDA_VSTD::__enable_if_t<_Constraints::__explicit_constructible, int> = 0>
__host__ __device__ _CCCL_CONSTEXPR_CXX14 explicit tuple(_Tuple&& __t) noexcept(
_LIBCUDACXX_TRAIT(_CUDA_VSTD::is_nothrow_constructible, super_t, _Tuple))
: super_t(_CUDA_VSTD::forward<_Tuple>(__t))
{}

template <class _Tuple,
class _Constraints = __tuple_like_constraints<const _Tuple&>,
_CUDA_VSTD::__enable_if_t<!_PackExpandsToThisTuple<_Tuple>::value, int> = 0,
_CUDA_VSTD::__enable_if_t<_Constraints::__explicit_constructible, int> = 0>
__host__ __device__ _CCCL_CONSTEXPR_CXX14 explicit tuple(const _Tuple& __t) noexcept(
_LIBCUDACXX_TRAIT(_CUDA_VSTD::is_nothrow_constructible, super_t, const _Tuple&))
: super_t(__t)
{}
#endif // _CCCL_COMPILER_MSVC_2017

Expand Down

0 comments on commit ec4e698

Please sign in to comment.