Skip to content

Commit

Permalink
Add workaround for MSVC2017
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed May 3, 2024
1 parent 162a1a7 commit fe3a98b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions thrust/thrust/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#endif // no system header

#include <cuda/std/tuple>
#include <cuda/std/type_traits>
#include <cuda/std/utility>

#include <tuple>
Expand Down Expand Up @@ -178,6 +179,23 @@ struct tuple : public _CUDA_VSTD::tuple<Ts...>
super_t::operator=(_CUDA_VSTD::forward<TupleLike>(other));
return *this;
}

#if defined(_CCCL_COMPILER_MSVC_2017)
// MSVC2017 needs some help to convert tuples
template <class... Us,
_CUDA_VSTD::__enable_if_t<!_CUDA_VSTD::is_same<tuple<Us...>, tuple>::value, int> = 0,
_CUDA_VSTD::__enable_if_t<_CUDA_VSTD::__tuple_convertible<_CUDA_VSTD::tuple<Us...>, super_t>::value, int> = 0>
_CCCL_HOST_DEVICE constexpr operator tuple<Us...>()
{
return __to_tuple<Us...>(typename _CUDA_VSTD::__make_tuple_indices<sizeof...(Ts)>::type{});
}

template <class... Us, size_t... Id>
_CCCL_HOST_DEVICE constexpr tuple<Us...> __to_tuple(_CUDA_VSTD::__tuple_indices<Id...>) const
{
return tuple<Us...>{_CUDA_VSTD::get<Id>(*this)...};
}
#endif // _CCCL_COMPILER_MSVC_2017
};

#if _CCCL_STD_VER >= 2017
Expand Down

0 comments on commit fe3a98b

Please sign in to comment.