diff --git a/include/boost/mp11/detail/mp_count.hpp b/include/boost/mp11/detail/mp_count.hpp index b9fa3fe..09cb0f6 100644 --- a/include/boost/mp11/detail/mp_count.hpp +++ b/include/boost/mp11/detail/mp_count.hpp @@ -43,11 +43,25 @@ constexpr std::size_t cx_plus(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T template struct mp_count_impl; -#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1930 ) +#if defined( BOOST_MP11_HAS_CXX14_CONSTEXPR ) + +template constexpr std::size_t cx_count() +{ + constexpr bool a[] = { false, std::is_same::value... }; + + std::size_t r = 0; + + for( std::size_t i = 0; i < sizeof...(T); ++i ) + { + r += a[ i+1 ]; + } + + return r; +} template class L, class... T, class V> struct mp_count_impl, V> { - using type = mp_size_t<(std::is_same::value + ... + 0)>; + using type = mp_size_t()>; }; #elif !defined( BOOST_MP11_NO_CONSTEXPR )