forked from boostorg/mp11
Added work around for Nvidia nvcc cuda compiler >= 9.0
* https://svn.boost.org/trac10/ticket/13513 * https://github.com/ComputationalRadiationPhysics/alpaka/issues/459#issuecomment-377678240
This commit is contained in:
@@ -95,6 +95,15 @@ struct list_size_mismatch
|
||||
{
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, / 1000000 == 9 )
|
||||
|
||||
template<template<class...> class F, class... L> struct mp_transform_cuda_workaround
|
||||
{
|
||||
using type = mp_if<mp_same<mp_size<L>...>, detail::mp_transform_impl<F, L...>, detail::list_size_mismatch>;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_MSVC, == 1900 ) || BOOST_WORKAROUND( BOOST_GCC, < 40800 )
|
||||
@@ -103,10 +112,18 @@ template<template<class...> class F, class... L> using mp_transform = typename m
|
||||
|
||||
#else
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, / 1000000 == 9 )
|
||||
|
||||
template<template<class...> class F, class... L> using mp_transform = typename detail::mp_transform_cuda_workaround< F, L...>::type::type;
|
||||
|
||||
#else
|
||||
|
||||
template<template<class...> class F, class... L> using mp_transform = typename mp_if<mp_same<mp_size<L>...>, detail::mp_transform_impl<F, L...>, detail::list_size_mismatch>::type;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
template<class Q, class... L> using mp_transform_q = mp_transform<Q::template fn, L...>;
|
||||
|
||||
namespace detail
|
||||
@@ -303,9 +320,27 @@ template<class L, std::size_t I> struct mp_at_c_impl
|
||||
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, / 1000000 == 9 )
|
||||
|
||||
template<class L, std::size_t I> struct mp_at_c_cuda_workaround
|
||||
{
|
||||
using type = mp_if_c<(I < mp_size<L>::value), detail::mp_at_c_impl<L, I>, void>;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, / 1000000 == 9 )
|
||||
|
||||
template<class L, std::size_t I> using mp_at_c = typename detail::mp_at_c_cuda_workaround< L, I >::type::type;
|
||||
|
||||
#else
|
||||
|
||||
template<class L, std::size_t I> using mp_at_c = typename mp_if_c<(I < mp_size<L>::value), detail::mp_at_c_impl<L, I>, void>::type;
|
||||
|
||||
#endif
|
||||
|
||||
template<class L, class I> using mp_at = mp_at_c<L, std::size_t{ I::value }>;
|
||||
|
||||
// mp_take(_c)<L, N>
|
||||
@@ -543,6 +578,25 @@ template<template<class...> class L, class T1, class... T, std::size_t I, templa
|
||||
|
||||
using L2 = mp_second<part>;
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, / 1000000 == 9 )
|
||||
|
||||
struct detail
|
||||
{
|
||||
struct mp_nth_element_impl_cuda_workaround
|
||||
{
|
||||
using type = mp_cond<
|
||||
|
||||
mp_bool<(I < N1)>, mp_nth_element_impl<L1, I, P>,
|
||||
mp_bool<(I == N1)>, mp_identity<T1>,
|
||||
mp_true, mp_nth_element_impl<L2, I - N1 - 1, P>
|
||||
|
||||
>;
|
||||
};
|
||||
};
|
||||
using type = typename detail::mp_nth_element_impl_cuda_workaround::type::type;
|
||||
|
||||
#else
|
||||
|
||||
using type = typename mp_cond<
|
||||
|
||||
mp_bool<(I < N1)>, mp_nth_element_impl<L1, I, P>,
|
||||
@@ -550,6 +604,8 @@ template<template<class...> class L, class T1, class... T, std::size_t I, templa
|
||||
mp_true, mp_nth_element_impl<L2, I - N1 - 1, P>
|
||||
|
||||
>::type;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
@@ -133,12 +133,28 @@ template<
|
||||
using type = typename mp_append_impl<prefix, Lr...>::type;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, / 1000000 == 9 )
|
||||
|
||||
template<class... L>
|
||||
struct mp_append_impl_cuda_workaround
|
||||
{
|
||||
using type = mp_if_c<(sizeof...(L) > 111), mp_quote<append_inf_impl>, mp_if_c<(sizeof...(L) > 11), mp_quote<append_111_impl>, mp_quote<append_11_impl>>>;
|
||||
};
|
||||
|
||||
template<class... L> struct mp_append_impl: mp_append_impl_cuda_workaround<L...>::type::template fn<L...>
|
||||
{
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template<class... L> struct mp_append_impl: mp_if_c<(sizeof...(L) > 111), mp_quote<append_inf_impl>, mp_if_c<(sizeof...(L) > 11), mp_quote<append_111_impl>, mp_quote<append_11_impl>>>::template fn<L...>
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class... L> using mp_append = typename detail::mp_append_impl<L...>::type;
|
||||
|
@@ -106,10 +106,27 @@ struct mp_no_type
|
||||
{
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, / 1000000 == 9 )
|
||||
|
||||
template<template<class...> class F, class... T> struct mp_defer_cuda_workaround
|
||||
{
|
||||
using type = mp_if<mp_valid<F, T...>, detail::mp_defer_impl<F, T...>, detail::mp_no_type>;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, / 1000000 == 9 )
|
||||
|
||||
template<template<class...> class F, class... T> using mp_defer = typename detail::mp_defer_cuda_workaround< F, T...>::type;
|
||||
|
||||
#else
|
||||
|
||||
template<template<class...> class F, class... T> using mp_defer = mp_if<mp_valid<F, T...>, detail::mp_defer_impl<F, T...>, detail::mp_no_type>;
|
||||
|
||||
#endif
|
||||
|
||||
// mp_eval_if, mp_eval_if_c
|
||||
namespace detail
|
||||
{
|
||||
|
Reference in New Issue
Block a user