From e81ce26bf96e17c9e5598d03b2589edec999a645 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 24 May 2017 05:59:15 +0300 Subject: [PATCH] Use fold expressions in mp_all, mp_any --- include/boost/mp11/function.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/boost/mp11/function.hpp b/include/boost/mp11/function.hpp index 7fe92cf..24054b6 100644 --- a/include/boost/mp11/function.hpp +++ b/include/boost/mp11/function.hpp @@ -91,6 +91,10 @@ template using mp_and = typename detail::mp_and_impl>: template using mp_all = mp_bool< mp_count_if< mp_list, mp_to_bool >::value == sizeof...(T) >; +#elif defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) + +template using mp_all = mp_bool<(static_cast(T::value) && ...)>; + #else template using mp_all = mp_and...>; @@ -128,8 +132,16 @@ template struct mp_or_impl } // namespace detail // mp_any +#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) + +template using mp_any = mp_bool<(static_cast(T::value) || ...)>; + +#else + template using mp_any = mp_bool< mp_count_if< mp_list, mp_to_bool >::value != 0 >; +#endif + // mp_same namespace detail {