diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index 4f24c4f..5a6a200 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -21,8 +21,7 @@ #include #include #include -#include -#include +#include #include #include @@ -41,7 +40,7 @@ template class F, class... L> struct mp_transform_impl template class F, template class L, class... T> struct mp_transform_impl> { -#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct f { using type = F; }; @@ -56,7 +55,7 @@ template class F, template class L, class... T> str template class F, template class L1, class... T1, template class L2, class... T2> struct mp_transform_impl, L2> { -#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct f { using type = F; }; @@ -71,7 +70,7 @@ template class F, template class L1, class... T1, t template class F, template class L1, class... T1, template class L2, class... T2, template class L3, class... T3> struct mp_transform_impl, L2, L3> { -#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct f { using type = F; }; @@ -84,7 +83,7 @@ template class F, template class L1, class... T1, t #endif }; -#if BOOST_WORKAROUND( BOOST_MSVC, == 1900 ) || BOOST_WORKAROUND( BOOST_GCC, < 40800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, == 1900 ) || BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 40800 ) template using mp_same_size_1 = mp_same...>; template struct mp_same_size_2: mp_defer {}; @@ -95,7 +94,7 @@ struct list_size_mismatch { }; -#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, >= 9000000 && BOOST_CUDA_VERSION < 10000000 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 ) template class F, class... L> struct mp_transform_cuda_workaround { @@ -106,13 +105,13 @@ template class F, class... L> struct mp_transform_cuda_workar } // namespace detail -#if BOOST_WORKAROUND( BOOST_MSVC, == 1900 ) || BOOST_WORKAROUND( BOOST_GCC, < 40800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, == 1900 ) || BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 40800 ) template class F, class... L> using mp_transform = typename mp_if::type, detail::mp_transform_impl, detail::list_size_mismatch>::type; #else -#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, >= 9000000 && BOOST_CUDA_VERSION < 10000000 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 ) template class F, class... L> using mp_transform = typename detail::mp_transform_cuda_workaround< F, L...>::type::type; @@ -155,7 +154,7 @@ template class P, template class F, class... L> str using Qp = mp_quote

; using Qf = mp_quote; -#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct _f_ { using type = mp_eval_if_q>, mp_first>, Qf, U...>; }; template using _f = typename _f_::type; @@ -182,7 +181,7 @@ template struct mp_fill_impl; template class L, class... T, class V> struct mp_fill_impl, V> { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1900 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1900 ) template struct _f { using type = V; }; using type = L::type...>; @@ -320,7 +319,7 @@ template struct mp_at_c_impl #endif -#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, >= 9000000 && BOOST_CUDA_VERSION < 10000000 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 ) template struct mp_at_c_cuda_workaround { @@ -331,7 +330,7 @@ template struct mp_at_c_cuda_workaround } // namespace detail -#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, >= 9000000 && BOOST_CUDA_VERSION < 10000000 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 ) template using mp_at_c = typename detail::mp_at_c_cuda_workaround< L, I >::type::type; @@ -392,7 +391,7 @@ template struct mp_replace_impl; template class L, class... T, class V, class W> struct mp_replace_impl, V, W> { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) template struct _f { using type = mp_if, W, A>; }; using type = L::type...>; #else @@ -413,7 +412,7 @@ template class P, class W> struct mp_replace_if_impl template class L, class... T, template class P, class W> struct mp_replace_if_impl, P, W> { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct _f { using type = mp_if, W, U>; }; using type = L::type...>; #else @@ -435,7 +434,7 @@ template class P> struct mp_copy_if_impl; template class L, class... T, template class P> struct mp_copy_if_impl, P> { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct _f { using type = mp_if, mp_list, mp_list<>>; }; using type = mp_append, typename _f::type...>; #else @@ -457,7 +456,7 @@ template struct mp_remove_impl; template class L, class... T, class V> struct mp_remove_impl, V> { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct _f { using type = mp_if, mp_list<>, mp_list>; }; using type = mp_append, typename _f::type...>; #else @@ -478,7 +477,7 @@ template class P> struct mp_remove_if_impl; template class L, class... T, template class P> struct mp_remove_if_impl, P> { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct _f { using type = mp_if, mp_list<>, mp_list>; }; using type = mp_append, typename _f::type...>; #else @@ -514,7 +513,7 @@ namespace detail template class P> struct mp_sort_impl; -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) template class L, class... T, template class P> struct mp_sort_impl, P> { @@ -578,7 +577,7 @@ template class L, class T1, class... T, std::size_t I, templa using L2 = mp_second; - #if BOOST_WORKAROUND( BOOST_CUDA_VERSION, >= 9000000 && BOOST_CUDA_VERSION < 10000000 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 ) struct detail { @@ -593,9 +592,10 @@ template class L, class T1, class... T, std::size_t I, templa >; }; }; + using type = typename detail::mp_nth_element_impl_cuda_workaround::type::type; - #else +#else using type = typename mp_cond< @@ -605,7 +605,7 @@ template class L, class T1, class... T, std::size_t I, templa >::type; - #endif +#endif }; } // namespace detail @@ -620,7 +620,7 @@ namespace detail template struct mp_find_impl; -#if defined( BOOST_CLANG ) && defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) +#if BOOST_MP11_CLANG && defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) struct mp_index_holder { @@ -657,7 +657,7 @@ template class L, class V> struct mp_find_impl, V> using type = mp_size_t<0>; }; -#if !defined( BOOST_NO_CXX14_CONSTEXPR ) +#if defined( BOOST_MP11_HAS_CXX14_CONSTEXPR ) constexpr std::size_t cx_find_index( bool const * first, bool const * last ) { @@ -689,7 +689,7 @@ template class L, class... T, class V> struct mp_find_impl class L, class... T, class V> struct mp_find_impl, V> { @@ -729,7 +729,7 @@ namespace detail template class P> struct mp_find_if_impl; -#if defined( BOOST_CLANG ) && defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) +#if BOOST_MP11_CLANG && defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) template class L, class... T, template class P> struct mp_find_if_impl, P> { @@ -752,7 +752,7 @@ template class L, class... T, template class P> str #else -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) template class L, class... T, template class P> struct mp_find_if_impl, P> { @@ -793,7 +793,7 @@ namespace detail template struct mp_reverse_impl; -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) template class L, class... T> struct mp_reverse_impl> { @@ -873,7 +873,7 @@ namespace detail template class F> struct mp_reverse_fold_impl; -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) template class L, class... T, class V, template class F> struct mp_reverse_fold_impl, V, F> { @@ -957,20 +957,20 @@ template using mp_replace_at_c = typename detai namespace detail { -template BOOST_CONSTEXPR F mp_for_each_impl( mp_list, F && f ) +template BOOST_MP11_CONSTEXPR F mp_for_each_impl( mp_list, F && f ) { using A = int[sizeof...(T)]; return (void)A{ ((void)f(T()), 0)... }, std::forward(f); } -template BOOST_CONSTEXPR F mp_for_each_impl( mp_list<>, F && f ) +template BOOST_MP11_CONSTEXPR F mp_for_each_impl( mp_list<>, F && f ) { return std::forward(f); } } // namespace detail -template BOOST_CONSTEXPR F mp_for_each( F && f ) +template BOOST_MP11_CONSTEXPR F mp_for_each( F && f ) { return detail::mp_for_each_impl( mp_rename(), std::forward(f) ); } diff --git a/include/boost/mp11/detail/config.hpp b/include/boost/mp11/detail/config.hpp index 489914d..9791db8 100644 --- a/include/boost/mp11/detail/config.hpp +++ b/include/boost/mp11/detail/config.hpp @@ -1,43 +1,114 @@ #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED #define BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED -// Copyright 2016 Peter Dimov. +// Copyright 2016, 2018 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include -#include +// BOOST_MP11_WORKAROUND -#if defined( BOOST_NO_CXX11_CONSTEXPR ) +#if defined( BOOST_STRICT_CONFIG ) || defined( BOOST_MP11_NO_WORKAROUNDS ) -# define BOOST_MP11_NO_CONSTEXPR +# define BOOST_MP11_WORKAROUND( symbol, test ) 0 -#elif defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#else -# define BOOST_MP11_NO_CONSTEXPR +# define BOOST_MP11_WORKAROUND( symbol, test ) ((symbol) != 0 && ((symbol) test)) #endif -#if defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603 +// -# define BOOST_MP11_HAS_FOLD_EXPRESSIONS +#define BOOST_MP11_CUDA 0 +#define BOOST_MP11_CLANG 0 +#define BOOST_MP11_INTEL 0 +#define BOOST_MP11_GCC 0 +#define BOOST_MP11_MSVC 0 -#elif defined(BOOST_CLANG) && defined(__has_cpp_attribute) -# if __has_cpp_attribute(fallthrough) && __cplusplus >= 201406L // Clang 3.9+ in c++1z mode +#define BOOST_MP11_CONSTEXPR constexpr -# define BOOST_MP11_HAS_FOLD_EXPRESSIONS +#if defined( __CUDACC__ ) + +// nvcc + +# undef BOOST_MP11_CUDA +# define BOOST_MP11_CUDA (__CUDACC_VER_MAJOR__ * 1000000 + __CUDACC_VER_MINOR__ * 10000 + __CUDACC_VER_BUILD__) + +// CUDA (8.0) has no constexpr support in msvc mode: +# if defined(_MSC_VER) && (BOOST_MP11_CUDA < 9000000) + +# define BOOST_MP11_NO_CONSTEXPR + +# undef BOOST_MP11_CONSTEXPR +# define BOOST_MP11_CONSTEXPR # endif + +#elif defined(__clang__) + +// clang++ + +# undef BOOST_MP11_CLANG +# define BOOST_MP11_CLANG (__clang_major__ * 100 + __clang_minor__) + +# if defined(__has_cpp_attribute) +# if __has_cpp_attribute(fallthrough) && __cplusplus >= 201406L // Clang 3.9+ in c++1z mode +# define BOOST_MP11_HAS_FOLD_EXPRESSIONS +# endif +# endif + +#elif defined(__INTEL_COMPILER) + +// Intel C++ + +# undef BOOST_MP11_INTEL +# define BOOST_MP11_INTEL __INTEL_COMPILER + +#elif defined(__GNUC__) + +// g++ + +# undef BOOST_MP11_GCC +# define BOOST_MP11_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + +#elif defined(_MSC_VER) + +// MS Visual C++ + +# undef BOOST_MP11_MSVC +# define BOOST_MP11_MSVC _MSC_VER + +# if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) +# define BOOST_MP11_NO_CONSTEXPR +# endif + +#if _MSC_FULL_VER < 190024210 // 2015u3 +# undef BOOST_MP11_CONSTEXPR +# define BOOST_MP11_CONSTEXPR #endif +#endif + +// BOOST_MP11_HAS_CXX14_CONSTEXPR + +#if !defined(BOOST_MP11_NO_CONSTEXPR) && defined(__cpp_constexpr) && __cpp_constexpr >= 201304 +# define BOOST_MP11_HAS_CXX14_CONSTEXPR +#endif + +// BOOST_MP11_HAS_FOLD_EXPRESSIONS + +#if !defined(BOOST_MP11_HAS_FOLD_EXPRESSIONS) && defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603 +# define BOOST_MP11_HAS_FOLD_EXPRESSIONS +#endif + +// BOOST_MP11_HAS_TYPE_PACK_ELEMENT + #if defined(__has_builtin) # if __has_builtin(__type_pack_element) - # define BOOST_MP11_HAS_TYPE_PACK_ELEMENT - # endif #endif diff --git a/include/boost/mp11/detail/mp_append.hpp b/include/boost/mp11/detail/mp_append.hpp index 1e48f01..8a8f4d5 100644 --- a/include/boost/mp11/detail/mp_append.hpp +++ b/include/boost/mp11/detail/mp_append.hpp @@ -10,8 +10,7 @@ #include #include -#include -#include +#include namespace boost { @@ -25,7 +24,7 @@ namespace detail template struct mp_append_impl; -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) template<> struct mp_append_impl<> { @@ -133,7 +132,7 @@ template< using type = typename mp_append_impl::type; }; -#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, >= 9000000 && BOOST_CUDA_VERSION < 10000000 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 ) template struct mp_append_impl_cuda_workaround diff --git a/include/boost/mp11/detail/mp_count.hpp b/include/boost/mp11/detail/mp_count.hpp index 4ae1144..4bd1953 100644 --- a/include/boost/mp11/detail/mp_count.hpp +++ b/include/boost/mp11/detail/mp_count.hpp @@ -11,7 +11,6 @@ #include #include #include -#include namespace boost { @@ -91,7 +90,7 @@ template class L, class... T, template class P> str template class L, class... T, template class P> struct mp_count_if_impl, P> { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct _f { using type = mp_to_bool>; }; using type = mp_size_t::type...>::value>; diff --git a/include/boost/mp11/detail/mp_fold.hpp b/include/boost/mp11/detail/mp_fold.hpp index 9afe013..0745e87 100644 --- a/include/boost/mp11/detail/mp_fold.hpp +++ b/include/boost/mp11/detail/mp_fold.hpp @@ -8,8 +8,7 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include -#include +#include namespace boost { @@ -25,7 +24,7 @@ template class F> struct mp_fold_impl // An error "no type named 'type'" here means that the first argument to mp_fold is not a list }; -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) template class L, class... T, class V, template class F> struct mp_fold_impl, V, F> { diff --git a/include/boost/mp11/detail/mp_plus.hpp b/include/boost/mp11/detail/mp_plus.hpp index f6d75ac..468a0e3 100644 --- a/include/boost/mp11/detail/mp_plus.hpp +++ b/include/boost/mp11/detail/mp_plus.hpp @@ -9,7 +9,6 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#include #include namespace boost @@ -38,7 +37,7 @@ template<> struct mp_plus_impl<> using type = std::integral_constant; }; -#if BOOST_WORKAROUND( BOOST_GCC, < 40800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 40800 ) template struct mp_plus_impl { diff --git a/include/boost/mp11/detail/mp_with_index.hpp b/include/boost/mp11/detail/mp_with_index.hpp index b198635..9843f83 100644 --- a/include/boost/mp11/detail/mp_with_index.hpp +++ b/include/boost/mp11/detail/mp_with_index.hpp @@ -9,12 +9,12 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#include +#include #include #include #include -#if !defined( BOOST_NO_CXX14_CONSTEXPR ) +#if defined( BOOST_MP11_HAS_CXX14_CONSTEXPR ) # define BOOST_MP11_CONSTEXPR14 constexpr #else # define BOOST_MP11_CONSTEXPR14 diff --git a/include/boost/mp11/function.hpp b/include/boost/mp11/function.hpp index 5968f52..d0fbb25 100644 --- a/include/boost/mp11/function.hpp +++ b/include/boost/mp11/function.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include namespace boost @@ -26,7 +27,7 @@ namespace mp11 // in detail/mp_void.hpp // mp_and -#if BOOST_WORKAROUND( BOOST_MSVC, < 1910 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1910 ) namespace detail { @@ -79,7 +80,7 @@ template using mp_and = typename detail::mp_and_impl>: #endif // mp_all -#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) || BOOST_WORKAROUND( BOOST_GCC, < 80200 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) || BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 80200 ) template using mp_all = mp_bool< mp_count_if< mp_list, mp_not >::value == 0 >; @@ -124,7 +125,7 @@ template struct mp_or_impl } // namespace detail // mp_any -#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_WORKAROUND( BOOST_GCC, < 80200 ) +#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 80200 ) template using mp_any = mp_bool<(static_cast(T::value) || ...)>; diff --git a/include/boost/mp11/list.hpp b/include/boost/mp11/list.hpp index 33e2d19..b764175 100644 --- a/include/boost/mp11/list.hpp +++ b/include/boost/mp11/list.hpp @@ -11,8 +11,7 @@ #include #include #include -#include -#include +#include #include namespace boost diff --git a/include/boost/mp11/tuple.hpp b/include/boost/mp11/tuple.hpp index a5de900..c65be1b 100644 --- a/include/boost/mp11/tuple.hpp +++ b/include/boost/mp11/tuple.hpp @@ -9,14 +9,13 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#include -#include +#include #include #include #include #include -#if defined(BOOST_MSVC) +#if BOOST_MP11_MSVC # pragma warning( push ) # pragma warning( disable: 4100 ) // unreferenced formal parameter 'tp' #endif @@ -30,7 +29,7 @@ namespace mp11 namespace detail { -template BOOST_CONSTEXPR auto tuple_apply_impl( F && f, Tp && tp, integer_sequence ) +template BOOST_MP11_CONSTEXPR auto tuple_apply_impl( F && f, Tp && tp, integer_sequence ) -> decltype( std::forward(f)( std::get(std::forward(tp))... ) ) { return std::forward(f)( std::get(std::forward(tp))... ); @@ -40,7 +39,7 @@ template BOOST_CONSTEXPR auto tuple_apply_i template::type>::value>> -BOOST_CONSTEXPR auto tuple_apply( F && f, Tp && tp ) +BOOST_MP11_CONSTEXPR auto tuple_apply( F && f, Tp && tp ) -> decltype( detail::tuple_apply_impl( std::forward(f), std::forward(tp), Seq() ) ) { return detail::tuple_apply_impl( std::forward(f), std::forward(tp), Seq() ); @@ -50,7 +49,7 @@ BOOST_CONSTEXPR auto tuple_apply( F && f, Tp && tp ) namespace detail { -template BOOST_CONSTEXPR T construct_from_tuple_impl( Tp && tp, integer_sequence ) +template BOOST_MP11_CONSTEXPR T construct_from_tuple_impl( Tp && tp, integer_sequence ) { return T( std::get(std::forward(tp))... ); } @@ -59,7 +58,7 @@ template BOOST_CONSTEXPR T construct_from_t template::type>::value>> -BOOST_CONSTEXPR T construct_from_tuple( Tp && tp ) +BOOST_MP11_CONSTEXPR T construct_from_tuple( Tp && tp ) { return detail::construct_from_tuple_impl( std::forward(tp), Seq() ); } @@ -68,20 +67,20 @@ BOOST_CONSTEXPR T construct_from_tuple( Tp && tp ) namespace detail { -template BOOST_CONSTEXPR F tuple_for_each_impl( Tp && tp, integer_sequence, F && f ) +template BOOST_MP11_CONSTEXPR F tuple_for_each_impl( Tp && tp, integer_sequence, F && f ) { using A = int[sizeof...(J)]; return (void)A{ ((void)f(std::get(std::forward(tp))), 0)... }, std::forward(f); } -template BOOST_CONSTEXPR F tuple_for_each_impl( Tp && /*tp*/, integer_sequence, F && f ) +template BOOST_MP11_CONSTEXPR F tuple_for_each_impl( Tp && /*tp*/, integer_sequence, F && f ) { return std::forward(f); } } // namespace detail -template BOOST_CONSTEXPR F tuple_for_each( Tp && tp, F && f ) +template BOOST_MP11_CONSTEXPR F tuple_for_each( Tp && tp, F && f ) { using seq = make_index_sequence::type>::value>; return detail::tuple_for_each_impl( std::forward(tp), seq(), std::forward(f) ); @@ -90,7 +89,7 @@ template BOOST_CONSTEXPR F tuple_for_each( Tp && tp, F && f ) } // namespace mp11 } // namespace boost -#if defined(BOOST_MSVC) +#if BOOST_MP11_MSVC # pragma warning( pop ) #endif diff --git a/include/boost/mp11/utility.hpp b/include/boost/mp11/utility.hpp index eb4fe08..e19ec8e 100644 --- a/include/boost/mp11/utility.hpp +++ b/include/boost/mp11/utility.hpp @@ -9,8 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#include -#include +#include namespace boost { @@ -54,7 +53,7 @@ template using mp_if = typename detail::mp_if_c_im // mp_valid -#if BOOST_WORKAROUND(BOOST_INTEL, BOOST_TESTED_AT(1800)) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_INTEL, != 0 ) // tested at 1800 // contributed by Roland Schulz in https://github.com/boostorg/mp11/issues/17 @@ -106,7 +105,7 @@ struct mp_no_type { }; -#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, >= 9000000 && BOOST_CUDA_VERSION < 10000000 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 ) template class F, class... T> struct mp_defer_cuda_workaround { @@ -117,7 +116,7 @@ template class F, class... T> struct mp_defer_cuda_workaround } // namespace detail -#if BOOST_WORKAROUND( BOOST_CUDA_VERSION, >= 9000000 && BOOST_CUDA_VERSION < 10000000 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_CUDA, >= 9000000 && BOOST_MP11_CUDA < 10000000 ) template class F, class... T> using mp_defer = typename detail::mp_defer_cuda_workaround< F, T...>::type; @@ -189,7 +188,7 @@ template class F> struct mp_quote_trait }; // mp_invoke -#if BOOST_WORKAROUND( BOOST_MSVC, < 1900 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) namespace detail { @@ -200,7 +199,7 @@ template struct mp_invoke_impl: mp_defer using mp_invoke = typename detail::mp_invoke_impl::type; -#elif BOOST_WORKAROUND( BOOST_GCC, < 50000 ) +#elif BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 50000 ) template using mp_invoke = typename mp_defer::type; diff --git a/test/construct_from_tuple.cpp b/test/construct_from_tuple.cpp index 5ff2dad..b4b7f34 100644 --- a/test/construct_from_tuple.cpp +++ b/test/construct_from_tuple.cpp @@ -12,9 +12,8 @@ #endif #include +#include #include -#include -#include #include #include #include @@ -33,7 +32,7 @@ struct T2 T2( std::unique_ptr x, std::unique_ptr y, std::unique_ptr z ): x(std::move(x)), y(std::move(y)), z(std::move(z)) {} -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) T2( T2&& r ): x( std::move(r.x) ), y( std::move(r.y) ), z( std::move(r.z) ) {} diff --git a/test/construct_from_tuple_cx.cpp b/test/construct_from_tuple_cx.cpp index 30abdbd..4820a86 100644 --- a/test/construct_from_tuple_cx.cpp +++ b/test/construct_from_tuple_cx.cpp @@ -12,11 +12,11 @@ #endif #include -#include +#include // Technically std::tuple isn't constexpr enabled in C++11, but it works with libstdc++ -#if defined( BOOST_NO_CXX11_CONSTEXPR ) || ( !defined( __GLIBCXX__ ) && __cplusplus < 201400L ) +#if defined( BOOST_MP11_NO_CONSTEXPR ) || ( !defined( __GLIBCXX__ ) && __cplusplus < 201400L ) int main() {} diff --git a/test/mp_all.cpp b/test/mp_all.cpp index 64c40e8..64f1e8f 100644 --- a/test/mp_all.cpp +++ b/test/mp_all.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -59,7 +60,7 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); -#if !BOOST_WORKAROUND( BOOST_GCC, < 40900 ) +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 40900 ) BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); diff --git a/test/mp_any.cpp b/test/mp_any.cpp index 4780ea9..cd0f247 100644 --- a/test/mp_any.cpp +++ b/test/mp_any.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -20,7 +21,7 @@ template using check2 = mp_any using check3 = mp_any...>, std::is_nothrow_default_constructible...>; template struct variant_base_impl {}; -#if BOOST_WORKAROUND( BOOST_GCC, < 40800 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 40800 ) template using variant_base = variant_base_impl...>::value, mp_any...>, std::is_nothrow_default_constructible...>::value, T...>; #else template using variant_base = variant_base_impl...>::value, mp_any...>, std::is_nothrow_default_constructible...>::value, T...>; diff --git a/test/mp_defer.cpp b/test/mp_defer.cpp index a21323d..e09973e 100644 --- a/test/mp_defer.cpp +++ b/test/mp_defer.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -47,12 +48,12 @@ int main() BOOST_TEST_TRAIT_FALSE((has_type>)); BOOST_TEST_TRAIT_FALSE((has_type>)); -#if !BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) BOOST_TEST_TRAIT_TRUE((has_type>)); #endif BOOST_TEST_TRAIT_TRUE((std::is_same::type, void*>)); -#if !BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) BOOST_TEST_TRAIT_TRUE((has_type>)); #endif BOOST_TEST_TRAIT_TRUE((std::is_same::type, int*>)); diff --git a/test/mp_fold.cpp b/test/mp_fold.cpp index a8b1a7e..8db9cc9 100644 --- a/test/mp_fold.cpp +++ b/test/mp_fold.cpp @@ -11,8 +11,6 @@ #include #include #include -#include -#include #include #include diff --git a/test/mp_for_each.cpp b/test/mp_for_each.cpp index c71a175..1335265 100644 --- a/test/mp_for_each.cpp +++ b/test/mp_for_each.cpp @@ -9,12 +9,11 @@ #include #include +#include #include -#include -#include #include -#if !defined( BOOST_NO_CXX14_CONSTEXPR ) +#if defined( BOOST_MP11_HAS_CXX14_CONSTEXPR ) # define CONSTEXPR14 constexpr #else # define CONSTEXPR14 @@ -46,7 +45,7 @@ int main() BOOST_TEST_EQ( (mp_for_each>( F{0} ).s), 12 ); -#if defined( BOOST_NO_CXX11_CONSTEXPR ) || ( !defined( __GLIBCXX__ ) && __cplusplus < 201400L ) +#if defined( BOOST_MP11_NO_CONSTEXPR ) || ( !defined( __GLIBCXX__ ) && __cplusplus < 201400L ) #else static_assert( mp_for_each>( 11 ) == 11, "mp_for_each>( 11 ) == 11" ); @@ -54,7 +53,7 @@ int main() #endif -#if !defined( BOOST_NO_CXX14_CONSTEXPR ) && !BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) +#if defined( BOOST_MP11_HAS_CXX14_CONSTEXPR ) constexpr auto r1 = mp_for_each>( F{0} ); static_assert( r1.s == 123, "r1.s == 123" ); diff --git a/test/mp_invoke_sf.cpp b/test/mp_invoke_sf.cpp index f100670..1e0152a 100644 --- a/test/mp_invoke_sf.cpp +++ b/test/mp_invoke_sf.cpp @@ -8,6 +8,7 @@ #include +#include #include #include @@ -33,8 +34,7 @@ int main() using Qt = mp_quote_trait; -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) -#else +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) BOOST_TEST_TRAIT_FALSE((mp_valid)); #endif BOOST_TEST_TRAIT_TRUE((mp_valid)); diff --git a/test/mp_quote.cpp b/test/mp_quote.cpp index 1591907..d98767e 100644 --- a/test/mp_quote.cpp +++ b/test/mp_quote.cpp @@ -8,6 +8,7 @@ #include +#include #include #include @@ -38,14 +39,12 @@ int main() { using Q = mp_quote; -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) -#else +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) using R1 = Y; BOOST_TEST_TRAIT_TRUE((std::is_same>)); #endif -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 && BOOST_MSVC >= 1900 ) -#else +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 && BOOST_MP11_MSVC >= 1900 ) using R2 = Z; BOOST_TEST_TRAIT_TRUE((std::is_same>)); #endif diff --git a/test/mp_quote_trait.cpp b/test/mp_quote_trait.cpp index 75c84ea..a334327 100644 --- a/test/mp_quote_trait.cpp +++ b/test/mp_quote_trait.cpp @@ -8,6 +8,7 @@ #include +#include #include #include @@ -43,7 +44,7 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same, void const>)); BOOST_TEST_TRAIT_TRUE((std::is_same, int const[]>)); -#if !BOOST_WORKAROUND( BOOST_GCC, < 40900 ) +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 40900 ) // g++ 4.7, 4.8 have difficulties with preserving top-level const diff --git a/test/mp_reverse.cpp b/test/mp_reverse.cpp index d1f2794..221440d 100644 --- a/test/mp_reverse.cpp +++ b/test/mp_reverse.cpp @@ -11,8 +11,6 @@ #include #include #include -#include -#include #include #include diff --git a/test/mp_reverse_fold.cpp b/test/mp_reverse_fold.cpp index 8452b7b..75c3089 100644 --- a/test/mp_reverse_fold.cpp +++ b/test/mp_reverse_fold.cpp @@ -11,8 +11,6 @@ #include #include #include -#include -#include #include #include diff --git a/test/mp_transform_sf.cpp b/test/mp_transform_sf.cpp index 7f18eab..e4f5515 100644 --- a/test/mp_transform_sf.cpp +++ b/test/mp_transform_sf.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include using boost::mp11::mp_transform; @@ -29,7 +30,7 @@ int main() BOOST_TEST_TRAIT_FALSE((mp_valid)); BOOST_TEST_TRAIT_FALSE((mp_valid)); -#if !BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) BOOST_TEST_TRAIT_TRUE((mp_valid>)); #endif diff --git a/test/mp_valid.cpp b/test/mp_valid.cpp index 15b57c3..f4e89d7 100644 --- a/test/mp_valid.cpp +++ b/test/mp_valid.cpp @@ -8,6 +8,7 @@ #include +#include #include template struct Xi @@ -52,7 +53,7 @@ int main() BOOST_TEST_TRAIT_FALSE((mp_valid)); BOOST_TEST_TRAIT_TRUE((mp_valid)); BOOST_TEST_TRAIT_TRUE((mp_valid)); -#if !defined( BOOST_MSVC ) || !BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) // msvc-12.0 can form pointer to reference BOOST_TEST_TRAIT_FALSE((mp_valid)); #endif @@ -63,10 +64,10 @@ int main() BOOST_TEST_TRAIT_TRUE((mp_valid)); BOOST_TEST_TRAIT_FALSE((mp_valid)); -#if !defined( BOOST_GCC ) || !BOOST_WORKAROUND( BOOST_GCC, < 70000 ) +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 70000 ) // g++ up to at least 6.3 doesn't like add_reference for some reason or other BOOST_TEST_TRAIT_FALSE((mp_valid)); -#if !defined( BOOST_MSVC ) || !BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) // msvc-12.0 gives an internal error here BOOST_TEST_TRAIT_FALSE((mp_valid)); #endif @@ -76,7 +77,7 @@ int main() BOOST_TEST_TRAIT_FALSE((mp_valid)); BOOST_TEST_TRAIT_TRUE((mp_valid)); -#if !defined( BOOST_MSVC ) || !BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) // msvc-12.0 can form arrays to void or int& BOOST_TEST_TRAIT_FALSE((mp_valid)); BOOST_TEST_TRAIT_FALSE((mp_valid)); diff --git a/test/mp_with_index.cpp b/test/mp_with_index.cpp index c149bd2..94cbb38 100644 --- a/test/mp_with_index.cpp +++ b/test/mp_with_index.cpp @@ -8,9 +8,8 @@ #include +#include #include -#include -#include #include using boost::mp11::mp_size_t; @@ -49,7 +48,7 @@ struct G int main() { -#if BOOST_WORKAROUND( BOOST_MSVC, < 1900 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) G()( mp_size_t<1>{} ); G()( mp_size_t<2>{} ); diff --git a/test/mp_with_index_cx.cpp b/test/mp_with_index_cx.cpp index 94370f9..3be9c2c 100644 --- a/test/mp_with_index_cx.cpp +++ b/test/mp_with_index_cx.cpp @@ -6,9 +6,9 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include +#include -#if defined( BOOST_NO_CXX14_CONSTEXPR ) +#if !defined( BOOST_MP11_HAS_CXX14_CONSTEXPR ) int main() {} @@ -16,8 +16,6 @@ int main() {} #include #include -#include -#include using boost::mp11::mp_size_t; using boost::mp11::mp_with_index; diff --git a/test/tuple_apply_cx.cpp b/test/tuple_apply_cx.cpp index 576a7b3..6f2f4e5 100644 --- a/test/tuple_apply_cx.cpp +++ b/test/tuple_apply_cx.cpp @@ -12,11 +12,11 @@ #endif #include -#include +#include // Technically std::tuple isn't constexpr enabled in C++11, but it works with libstdc++ -#if defined( BOOST_NO_CXX11_CONSTEXPR ) || ( !defined( __GLIBCXX__ ) && __cplusplus < 201400L ) +#if defined( BOOST_MP11_NO_CONSTEXPR ) || ( !defined( __GLIBCXX__ ) && __cplusplus < 201400L ) int main() {} diff --git a/test/tuple_for_each_cx.cpp b/test/tuple_for_each_cx.cpp index ff1d043..f511e81 100644 --- a/test/tuple_for_each_cx.cpp +++ b/test/tuple_for_each_cx.cpp @@ -12,11 +12,11 @@ #endif #include -#include +#include // Technically std::tuple isn't constexpr enabled in C++11, but it works with libstdc++ -#if defined( BOOST_NO_CXX11_CONSTEXPR ) || ( !defined( __GLIBCXX__ ) && __cplusplus < 201400L ) +#if defined( BOOST_MP11_NO_CONSTEXPR ) || ( !defined( __GLIBCXX__ ) && __cplusplus < 201400L ) int main() {}