1
0
forked from boostorg/mp11

Merge branch 'develop' of github.com:boostorg/mp11 into workaround-nvcc-cuda

This commit is contained in:
Alexander Matthes
2018-04-26 20:29:02 +02:00
8 changed files with 61 additions and 33 deletions

View File

@@ -185,6 +185,24 @@ matrix:
packages: packages:
- libc++-dev - libc++-dev
- os: linux
compiler: clang++-5.0
env: CLANG_X_CUDA=1
addons:
apt:
packages:
- clang-5.0
- nvidia-profiler
- nvidia-cuda-dev
- nvidia-cuda-toolkit
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
script:
- clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -D__device__="__attribute__((device))" -std=c++11 libs/mp11/test/mp11.cpp
- clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -D__device__="__attribute__((device))" -std=c++14 libs/mp11/test/mp11.cpp
- clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -D__device__="__attribute__((device))" -std=c++1z libs/mp11/test/mp11.cpp
- os: osx - os: osx
compiler: clang++ compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z env: TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z
@@ -206,7 +224,7 @@ install:
script: script:
- |- - |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 -j3 libs/mp11/test toolset=$TOOLSET cxxstd=$CXXSTD - ./b2 -j3 libs/mp11/test toolset=$TOOLSET cxxstd=$CXXSTD ${CXXFLAGS:+cxxflags="$CXXFLAGS"}
notifications: notifications:
email: email:

View File

@@ -314,8 +314,8 @@ template<template<class...> class L, class... T, std::size_t I> struct mp_at_c_i
template<class L, std::size_t I> struct mp_at_c_impl template<class L, std::size_t I> struct mp_at_c_impl
{ {
using _map = mp_transform<mp_list, mp_iota<mp_size<L>>, L>; using _map = mp_transform<mp_list, mp_iota<mp_size<L> >, L>;
using type = mp_second<mp_map_find<_map, mp_size_t<I>>>; using type = mp_second<mp_map_find<_map, mp_size_t<I> > >;
}; };
#endif #endif
@@ -899,7 +899,7 @@ template<template<class...> class L, class T1, class... T, class V, template<cla
template<template<class...> class L, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10, class... T, class V, template<class...> class F> struct mp_reverse_fold_impl<L<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T...>, V, F> template<template<class...> class L, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10, class... T, class V, template<class...> class F> struct mp_reverse_fold_impl<L<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T...>, V, F>
{ {
using rest = typename mp_reverse_fold_impl<L<T...>, V, F>::type; using rest = typename mp_reverse_fold_impl<L<T...>, V, F>::type;
using type = F<T1, F<T2, F<T3, F<T4, F<T5, F<T6, F<T7, F<T8, F<T9, F<T10, rest>>>>>>>>>>; using type = F<T1, F<T2, F<T3, F<T4, F<T5, F<T6, F<T7, F<T8, F<T9, F<T10, rest> > > > > > > > > >;
}; };
} // namespace detail } // namespace detail
@@ -945,7 +945,7 @@ template<class L, class I, class W> struct mp_replace_at_impl
template<class T1, class T2> using _p = std::is_same<T2, mp_size_t<I::value>>; template<class T1, class T2> using _p = std::is_same<T2, mp_size_t<I::value>>;
template<class T1, class T2> using _f = W; template<class T1, class T2> using _f = W;
using type = mp_transform_if<_p, _f, L, mp_iota<mp_size<L>>>; using type = mp_transform_if<_p, _f, L, mp_iota<mp_size<L> > >;
}; };
} // namespace detail } // namespace detail

View File

@@ -1,7 +1,7 @@
#ifndef BOOST_MP11_BIND_HPP_INCLUDED #ifndef BOOST_MP11_BIND_HPP_INCLUDED
#define BOOST_MP11_BIND_HPP_INCLUDED #define BOOST_MP11_BIND_HPP_INCLUDED
// Copyright 2017 Peter Dimov. // Copyright 2017, 2018 Peter Dimov.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// //
@@ -17,6 +17,25 @@ namespace boost
namespace mp11 namespace mp11
{ {
// mp_bind_front
template<template<class...> class F, class... T> struct mp_bind_front
{
// the indirection through mp_defer works around the language inability
// to expand U... into a fixed parameter list of an alias template
template<class... U> using fn = typename mp_defer<F, T..., U...>::type;
};
template<class Q, class... T> using mp_bind_front_q = mp_bind_front<Q::template fn, T...>;
// mp_bind_back
template<template<class...> class F, class... T> struct mp_bind_back
{
template<class... U> using fn = typename mp_defer<F, U..., T...>::type;
};
template<class Q, class... T> using mp_bind_back_q = mp_bind_back<Q::template fn, T...>;
// mp_arg // mp_arg
template<std::size_t I> struct mp_arg template<std::size_t I> struct mp_arg
{ {
@@ -54,6 +73,16 @@ template<template<class...> class F, class... U, class... T> struct eval_bound_a
using type = typename mp_bind<F, U...>::template fn<T...>; using type = typename mp_bind<F, U...>::template fn<T...>;
}; };
template<template<class...> class F, class... U, class... T> struct eval_bound_arg<mp_bind_front<F, U...>, T...>
{
using type = typename mp_bind_front<F, U...>::template fn<T...>;
};
template<template<class...> class F, class... U, class... T> struct eval_bound_arg<mp_bind_back<F, U...>, T...>
{
using type = typename mp_bind_back<F, U...>::template fn<T...>;
};
} // namespace detail } // namespace detail
template<template<class...> class F, class... T> struct mp_bind template<template<class...> class F, class... T> struct mp_bind
@@ -63,25 +92,6 @@ template<template<class...> class F, class... T> struct mp_bind
template<class Q, class... T> using mp_bind_q = mp_bind<Q::template fn, T...>; template<class Q, class... T> using mp_bind_q = mp_bind<Q::template fn, T...>;
// mp_bind_front
template<template<class...> class F, class... T> struct mp_bind_front
{
// the indirection through mp_defer works around the language inability
// to expand U... into a fixed parameter list of an alias template
template<class... U> using fn = typename mp_defer<F, T..., U...>::type;
};
template<class Q, class... T> using mp_bind_front_q = mp_bind_front<Q::template fn, T...>;
// mp_bind_back
template<template<class...> class F, class... T> struct mp_bind_back
{
template<class... U> using fn = typename mp_defer<F, U..., T...>::type;
};
template<class Q, class... T> using mp_bind_back_q = mp_bind_back<Q::template fn, T...>;
} // namespace mp11 } // namespace mp11
} // namespace boost } // namespace boost

View File

@@ -138,7 +138,7 @@ template<
template<class... L> template<class... L>
struct mp_append_impl_cuda_workaround 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>>>; 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...> template<class... L> struct mp_append_impl: mp_append_impl_cuda_workaround<L...>::type::template fn<L...>
@@ -147,7 +147,7 @@ template<class... L> struct mp_append_impl: mp_append_impl_cuda_workaround<L...>
#else #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...> 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...>
{ {
}; };

View File

@@ -79,7 +79,7 @@ template<class... T> using mp_and = typename detail::mp_and_impl<mp_list<T...>>:
#endif #endif
// mp_all<T...> // mp_all<T...>
#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) || BOOST_WORKAROUND( BOOST_GCC, < 70300 ) #if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) || BOOST_WORKAROUND( BOOST_GCC, < 70400 )
template<class... T> using mp_all = mp_bool< mp_count_if< mp_list<T...>, mp_not >::value == 0 >; template<class... T> using mp_all = mp_bool< mp_count_if< mp_list<T...>, mp_not >::value == 0 >;
@@ -124,7 +124,7 @@ template<class T1, class... T> struct mp_or_impl<T1, T...>
} // namespace detail } // namespace detail
// mp_any<T...> // mp_any<T...>
#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_WORKAROUND( BOOST_GCC, < 70300 ) #if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_WORKAROUND( BOOST_GCC, < 70400 )
template<class... T> using mp_any = mp_bool<(static_cast<bool>(T::value) || ...)>; template<class... T> using mp_any = mp_bool<(static_cast<bool>(T::value) || ...)>;

View File

@@ -73,7 +73,7 @@ public:
using type = S4; using type = S4;
}; };
template<class T, T N> struct make_integer_sequence_impl: iseq_if_c<N == 0, iseq_identity<integer_sequence<T>>, iseq_if_c<N == 1, iseq_identity<integer_sequence<T, 0>>, make_integer_sequence_impl_<T, N>>> template<class T, T N> struct make_integer_sequence_impl: iseq_if_c<N == 0, iseq_identity<integer_sequence<T>>, iseq_if_c<N == 1, iseq_identity<integer_sequence<T, 0>>, make_integer_sequence_impl_<T, N> > >
{ {
}; };

View File

@@ -58,7 +58,7 @@ template<class M, class T, template<class...> class F> struct mp_map_update_impl
template<class U> using _f = std::is_same<mp_first<T>, mp_first<U>>; template<class U> using _f = std::is_same<mp_first<T>, mp_first<U>>;
// _f3<L<X, Y...>> -> L<X, F<X, Y...>> // _f3<L<X, Y...>> -> L<X, F<X, Y...>>
template<class L> using _f3 = mp_assign<L, mp_list<mp_first<L>, mp_rename<L, F>>>; template<class L> using _f3 = mp_assign<L, mp_list<mp_first<L>, mp_rename<L, F> > >;
using type = mp_if< mp_map_contains<M, mp_first<T>>, mp_transform_if<_f, _f3, M>, mp_push_back<M, T> >; using type = mp_if< mp_map_contains<M, mp_first<T>>, mp_transform_if<_f, _f3, M>, mp_push_back<M, T> >;
}; };

View File

@@ -25,7 +25,7 @@ template<class S, class V> struct mp_set_contains_impl;
template<template<class...> class L, class... T, class V> struct mp_set_contains_impl<L<T...>, V> template<template<class...> class L, class... T, class V> struct mp_set_contains_impl<L<T...>, V>
{ {
using type = mp_to_bool<std::is_base_of<mp_identity<V>, mp_inherit<mp_identity<T>...>>>; using type = mp_to_bool<std::is_base_of<mp_identity<V>, mp_inherit<mp_identity<T>...> > >;
}; };
} // namespace detail } // namespace detail
@@ -90,7 +90,7 @@ template<class S> struct mp_is_set_impl
template<template<class...> class L, class... T> struct mp_is_set_impl<L<T...>> template<template<class...> class L, class... T> struct mp_is_set_impl<L<T...>>
{ {
using type = mp_to_bool<std::is_same<mp_list<T...>, mp_set_push_back<mp_list<>, T...>>>; using type = mp_to_bool<std::is_same<mp_list<T...>, mp_set_push_back<mp_list<>, T...> > >;
}; };
} // namespace detail } // namespace detail