diff options
Diffstat (limited to 'boost/mp11')
-rw-r--r-- | boost/mp11/algorithm.hpp | 6 | ||||
-rw-r--r-- | boost/mp11/bind.hpp | 27 | ||||
-rw-r--r-- | boost/mp11/detail/config.hpp | 2 | ||||
-rw-r--r-- | boost/mp11/detail/mp_append.hpp | 2 | ||||
-rw-r--r-- | boost/mp11/detail/mp_fold.hpp | 2 | ||||
-rw-r--r-- | boost/mp11/detail/mp_plus.hpp | 2 | ||||
-rw-r--r-- | boost/mp11/detail/mp_void.hpp | 32 | ||||
-rw-r--r-- | boost/mp11/function.hpp | 13 | ||||
-rw-r--r-- | boost/mp11/list.hpp | 2 | ||||
-rw-r--r-- | boost/mp11/tuple.hpp | 17 | ||||
-rw-r--r-- | boost/mp11/utility.hpp | 26 |
11 files changed, 81 insertions, 50 deletions
diff --git a/boost/mp11/algorithm.hpp b/boost/mp11/algorithm.hpp index 81d6ef9d4f..23758f7076 100644 --- a/boost/mp11/algorithm.hpp +++ b/boost/mp11/algorithm.hpp @@ -22,7 +22,7 @@ #include <boost/mp11/detail/config.hpp> #include <boost/mp11/integer_sequence.hpp> #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <type_traits> #include <utility> @@ -907,15 +907,11 @@ template<class... T, class F> BOOST_CONSTEXPR F mp_for_each_impl( mp_list<T...>, return (void)A{ ((void)f(T()), 0)... }, std::forward<F>(f); } -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) - template<class F> BOOST_CONSTEXPR F mp_for_each_impl( mp_list<>, F && f ) { return std::forward<F>(f); } -#endif - } // namespace detail template<class L, class F> BOOST_CONSTEXPR F mp_for_each( F && f ) diff --git a/boost/mp11/bind.hpp b/boost/mp11/bind.hpp index 38e1b8ccc1..ac257d45f6 100644 --- a/boost/mp11/bind.hpp +++ b/boost/mp11/bind.hpp @@ -9,6 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include <boost/mp11/algorithm.hpp> +#include <boost/mp11/utility.hpp> #include <cstddef> namespace boost @@ -65,19 +66,10 @@ 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 { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 && BOOST_MSVC >= 1900 ) -#else -private: -#endif + // 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> struct _fn { using type = F<T..., U...>; }; - -public: - - // the indirection through _fn works around the language inability - // to expand U... into a fixed parameter list of an alias template - - template<class... U> using fn = typename _fn<U...>::type; + 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...>; @@ -85,16 +77,7 @@ template<class Q, class... T> using mp_bind_front_q = mp_bind_front<Q::template // mp_bind_back template<template<class...> class F, class... T> struct mp_bind_back { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 && BOOST_MSVC >= 1900 ) -#else -private: -#endif - - template<class... U> struct _fn { using type = F<U..., T...>; }; - -public: - - template<class... U> using fn = typename _fn<U...>::type; + 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...>; diff --git a/boost/mp11/detail/config.hpp b/boost/mp11/detail/config.hpp index 68413d77cc..489914d661 100644 --- a/boost/mp11/detail/config.hpp +++ b/boost/mp11/detail/config.hpp @@ -9,7 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #if defined( BOOST_NO_CXX11_CONSTEXPR ) diff --git a/boost/mp11/detail/mp_append.hpp b/boost/mp11/detail/mp_append.hpp index 67ac03e042..e58c8a70c5 100644 --- a/boost/mp11/detail/mp_append.hpp +++ b/boost/mp11/detail/mp_append.hpp @@ -11,7 +11,7 @@ #include <boost/mp11/detail/mp_list.hpp> #include <boost/mp11/utility.hpp> #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> namespace boost { diff --git a/boost/mp11/detail/mp_fold.hpp b/boost/mp11/detail/mp_fold.hpp index ae6f97471d..9afe01337b 100644 --- a/boost/mp11/detail/mp_fold.hpp +++ b/boost/mp11/detail/mp_fold.hpp @@ -9,7 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> namespace boost { diff --git a/boost/mp11/detail/mp_plus.hpp b/boost/mp11/detail/mp_plus.hpp index 1028fa5ec5..f6d75acdf3 100644 --- a/boost/mp11/detail/mp_plus.hpp +++ b/boost/mp11/detail/mp_plus.hpp @@ -9,7 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include <boost/mp11/detail/config.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <type_traits> namespace boost diff --git a/boost/mp11/detail/mp_void.hpp b/boost/mp11/detail/mp_void.hpp new file mode 100644 index 0000000000..a7ac7b7162 --- /dev/null +++ b/boost/mp11/detail/mp_void.hpp @@ -0,0 +1,32 @@ +#ifndef BOOST_MP11_DETAIL_MP_VOID_HPP_INCLUDED +#define BOOST_MP11_DETAIL_MP_VOID_HPP_INCLUDED + +// Copyright 2015-2017 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 + +namespace boost +{ +namespace mp11 +{ + +// mp_void<T...> +namespace detail +{ + +template<class... T> struct mp_void_impl +{ + using type = void; +}; + +} // namespace detail + +template<class... T> using mp_void = typename detail::mp_void_impl<T...>::type; + +} // namespace mp11 +} // namespace boost + +#endif // #ifndef BOOST_MP11_DETAIL_MP_VOID_HPP_INCLUDED diff --git a/boost/mp11/function.hpp b/boost/mp11/function.hpp index ddcd45d5d7..596f0636ef 100644 --- a/boost/mp11/function.hpp +++ b/boost/mp11/function.hpp @@ -14,6 +14,7 @@ #include <boost/mp11/detail/mp_count.hpp> #include <boost/mp11/detail/mp_plus.hpp> #include <boost/mp11/detail/mp_min_element.hpp> +#include <boost/mp11/detail/mp_void.hpp> #include <type_traits> namespace boost @@ -22,17 +23,7 @@ namespace mp11 { // mp_void<T...> -namespace detail -{ - -template<class... T> struct mp_void_impl -{ - using type = void; -}; - -} // namespace detail - -template<class... T> using mp_void = typename detail::mp_void_impl<T...>::type; +// in detail/mp_void.hpp // mp_and<T...> #if BOOST_WORKAROUND( BOOST_MSVC, < 1910 ) diff --git a/boost/mp11/list.hpp b/boost/mp11/list.hpp index f66d6124a7..33e2d199fa 100644 --- a/boost/mp11/list.hpp +++ b/boost/mp11/list.hpp @@ -12,7 +12,7 @@ #include <boost/mp11/detail/mp_list.hpp> #include <boost/mp11/detail/mp_append.hpp> #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <type_traits> namespace boost diff --git a/boost/mp11/tuple.hpp b/boost/mp11/tuple.hpp index afcd119d8d..a5de900959 100644 --- a/boost/mp11/tuple.hpp +++ b/boost/mp11/tuple.hpp @@ -10,12 +10,17 @@ #include <boost/mp11/integer_sequence.hpp> #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <tuple> #include <utility> #include <type_traits> #include <cstddef> +#if defined(BOOST_MSVC) +# pragma warning( push ) +# pragma warning( disable: 4100 ) // unreferenced formal parameter 'tp' +#endif + namespace boost { namespace mp11 @@ -69,15 +74,11 @@ template<class Tp, std::size_t... J, class F> BOOST_CONSTEXPR F tuple_for_each_i return (void)A{ ((void)f(std::get<J>(std::forward<Tp>(tp))), 0)... }, std::forward<F>(f); } -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) - -template<class Tp, class F> BOOST_CONSTEXPR F tuple_for_each_impl( Tp && tp, integer_sequence<std::size_t>, F && f ) +template<class Tp, class F> BOOST_CONSTEXPR F tuple_for_each_impl( Tp && /*tp*/, integer_sequence<std::size_t>, F && f ) { return std::forward<F>(f); } -#endif - } // namespace detail template<class Tp, class F> BOOST_CONSTEXPR F tuple_for_each( Tp && tp, F && f ) @@ -89,4 +90,8 @@ template<class Tp, class F> BOOST_CONSTEXPR F tuple_for_each( Tp && tp, F && f ) } // namespace mp11 } // namespace boost +#if defined(BOOST_MSVC) +# pragma warning( pop ) +#endif + #endif // #ifndef BOOST_TUPLE_HPP_INCLUDED diff --git a/boost/mp11/utility.hpp b/boost/mp11/utility.hpp index 5935e6da79..4fd98e1c12 100644 --- a/boost/mp11/utility.hpp +++ b/boost/mp11/utility.hpp @@ -10,7 +10,7 @@ #include <boost/mp11/integral.hpp> #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> namespace boost { @@ -53,6 +53,28 @@ template<bool C, class T, class... E> using mp_if_c = typename detail::mp_if_c_i template<class C, class T, class... E> using mp_if = typename detail::mp_if_c_impl<static_cast<bool>(C::value), T, E...>::type; // mp_valid + +#if BOOST_WORKAROUND(BOOST_INTEL, BOOST_TESTED_AT(1800)) + +// contributed by Roland Schulz in https://github.com/boostorg/mp11/issues/17 + +namespace detail +{ + +template<class...> using void_t = void; + +template<class, template<class...> class F, class... T> +struct mp_valid_impl: mp_false {}; + +template<template<class...> class F, class... T> +struct mp_valid_impl<void_t<F<T...>>, F, T...>: mp_true {}; + +} // namespace detail + +template<template<class...> class F, class... T> using mp_valid = typename detail::mp_valid_impl<void, F, T...>; + +#else + // implementation by Bruno Dutra (by the name is_evaluable) namespace detail { @@ -69,6 +91,8 @@ template<template<class...> class F, class... T> struct mp_valid_impl template<template<class...> class F, class... T> using mp_valid = typename detail::mp_valid_impl<F, T...>::type; +#endif + // mp_defer namespace detail { |