diff --git a/include/boost/mp11/detail/mp_plus.hpp b/include/boost/mp11/detail/mp_plus.hpp index c27e6de..57cf3cc 100644 --- a/include/boost/mp11/detail/mp_plus.hpp +++ b/include/boost/mp11/detail/mp_plus.hpp @@ -8,7 +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 @@ -20,6 +20,16 @@ namespace mp11 namespace detail { +#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) + +template struct mp_plus_impl +{ + static const auto _v = (T::value + ... + 0); + using type = std::integral_constant::type, _v>; +}; + +#else + template struct mp_plus_impl; template<> struct mp_plus_impl<> @@ -29,16 +39,18 @@ template<> struct mp_plus_impl<> template struct mp_plus_impl { - static const/*expr*/ auto _v = T1::value + mp_plus_impl::type::value; + static const auto _v = T1::value + mp_plus_impl::type::value; using type = std::integral_constant::type, _v>; }; template struct mp_plus_impl { - static const/*expr*/ auto _v = T1::value + T2::value + T3::value + T4::value + T5::value + T6::value + T7::value + T8::value + T9::value + T10::value + mp_plus_impl::type::value; + static const auto _v = T1::value + T2::value + T3::value + T4::value + T5::value + T6::value + T7::value + T8::value + T9::value + T10::value + mp_plus_impl::type::value; using type = std::integral_constant::type, _v>; }; +#endif + } // namespace detail template using mp_plus = typename detail::mp_plus_impl::type;