1
0
forked from boostorg/mp11

mp_count_if: do not use fold expressions on msvc-14.2 because of parser stack limit

This commit is contained in:
Peter Dimov
2020-11-26 00:23:13 +02:00
parent 90f40dd999
commit 6bb260ff65

View File

@@ -21,16 +21,7 @@ namespace mp11
namespace detail
{
template<class L, class V> struct mp_count_impl;
#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS )
template<template<class...> class L, class... T, class V> struct mp_count_impl<L<T...>, V>
{
using type = mp_size_t<(std::is_same<T, V>::value + ... + 0)>;
};
#elif !defined( BOOST_MP11_NO_CONSTEXPR )
#if !defined( BOOST_MP11_NO_CONSTEXPR )
constexpr std::size_t cx_plus()
{
@@ -48,6 +39,19 @@ constexpr std::size_t cx_plus(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T
return static_cast<std::size_t>(t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10) + cx_plus(t...);
}
#endif
template<class L, class V> struct mp_count_impl;
#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS )
template<template<class...> class L, class... T, class V> struct mp_count_impl<L<T...>, V>
{
using type = mp_size_t<(std::is_same<T, V>::value + ... + 0)>;
};
#elif !defined( BOOST_MP11_NO_CONSTEXPR )
template<template<class...> class L, class... T, class V> struct mp_count_impl<L<T...>, V>
{
using type = mp_size_t<cx_plus(std::is_same<T, V>::value...)>;
@@ -72,7 +76,7 @@ namespace detail
template<class L, template<class...> class P> struct mp_count_if_impl;
#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 )
#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1930 )
template<template<class...> class L, class... T, template<class...> class P> struct mp_count_if_impl<L<T...>, P>
{