diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index be377f5a..e866d60a 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -148,7 +148,7 @@ template class F, template class L1, class... T1, t namespace detail { -template class P, template class F, class... L> struct mp_transform_if_impl +template class P, template class F> struct mp_transform_if_impl_f { // the stupid quote-unquote dance avoids "pack expansion used as argument for non-pack parameter of alias template" @@ -165,8 +165,11 @@ template class P, template class F, class... L> str template using _f = mp_eval_if_q>, mp_first>, Qf, U...>; #endif +}; - using type = mp_transform<_f, L...>; +template class P, template class F, class... L> struct mp_transform_if_impl +{ + using type = mp_transform::template _f, L...>; }; } // namespace detail @@ -178,13 +181,16 @@ template using mp_transform_if_q = typename deta namespace detail { -template class P, class L1, class... L> struct mp_filter_impl +template class P> struct mp_filter_impl_f { using Qp = mp_quote

; template using _f = mp_if< mp_invoke_q, mp_list, mp_list<> >; +}; - using _t1 = mp_transform<_f, L1, L...>; +template class P, class L1, class... L> struct mp_filter_impl +{ + using _t1 = mp_transform::template _f, L1, L...>; using _t2 = mp_apply; using type = mp_assign; @@ -305,11 +311,14 @@ namespace detail template struct mp_drop_impl; -template class L, class... T, template class L2, class... U> struct mp_drop_impl, L2, mp_true> +template class L, class... U> struct mp_drop_impl_f { template static mp_identity> f( U*..., mp_identity*... ); +}; - using R = decltype( f( static_cast*>(0) ... ) ); +template class L, class... T, template class L2, class... U> struct mp_drop_impl, L2, mp_true> +{ + using R = decltype( mp_drop_impl_f::f( static_cast*>(0) ... ) ); using type = typename R::type; }; @@ -606,11 +615,14 @@ template class L, class T1, template class P> struc using type = L; }; -template class L, class T1, class... T, template class P> struct mp_sort_impl, P> +template class P> struct mp_sort_impl_f { - template using F = P; + template using f = P; +}; - using part = mp_partition, F>; +template class L, class T1, class... T, template class P> struct mp_sort_impl, P> +{ + using part = mp_partition, mp_sort_impl_f::template f>; using S1 = typename mp_sort_impl, P>::type; using S2 = typename mp_sort_impl, P>::type; @@ -1035,14 +1047,36 @@ template using mp_any_of_q = mp_any_of; namespace detail { +#if ! BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) + +template struct mp_replace_at_impl_p +{ + template using _p = std::is_same; +}; + +template struct mp_replace_at_impl_f +{ + template using _f = W; +}; + +#endif + template struct mp_replace_at_impl { static_assert( I::value >= 0, "mp_replace_at: I must not be negative" ); +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) + template using _p = std::is_same>; template using _f = W; using type = mp_transform_if<_p, _f, L, mp_iota > >; + +#else + + using type = mp_transform_if>::template _p, mp_replace_at_impl_f::template _f, L, mp_iota > >; + +#endif }; } // namespace detail @@ -1187,13 +1221,16 @@ template class L> struct mp_power_set_impl< L<> > #endif +template struct mp_power_set_impl_f +{ + template using _f = mp_push_front; +}; + template class L, class T1, class... T> struct mp_power_set_impl< L > { using S1 = mp_power_set< L >; - template using _f = mp_push_front; - - using S2 = mp_transform<_f, S1>; + using S2 = mp_transform::template _f, S1>; using type = mp_append< S1, S2 >; }; diff --git a/include/boost/mp11/detail/mp_map_find.hpp b/include/boost/mp11/detail/mp_map_find.hpp index 2fb70d8e..c51964c2 100644 --- a/include/boost/mp11/detail/mp_map_find.hpp +++ b/include/boost/mp11/detail/mp_map_find.hpp @@ -67,14 +67,17 @@ template using mpmf_unwrap = typename mpmf_unwrap_impl::type; template struct mp_map_find_impl; -template class M, class... T, class K> struct mp_map_find_impl, K> +template struct mp_map_find_impl_f { - using U = mp_inherit...>; - template class L, class... U> static mp_identity> f( mp_identity>* ); static mp_identity f( ... ); +}; + +template class M, class... T, class K> struct mp_map_find_impl, K> +{ + using U = mp_inherit...>; - using type = mpmf_unwrap< decltype( f( static_cast(0) ) ) >; + using type = mpmf_unwrap< decltype( mp_map_find_impl_f::f( static_cast(0) ) ) >; }; } // namespace detail diff --git a/include/boost/mp11/map.hpp b/include/boost/mp11/map.hpp index b9581ac9..e7a08304 100644 --- a/include/boost/mp11/map.hpp +++ b/include/boost/mp11/map.hpp @@ -38,11 +38,19 @@ template class M, class... U, class T> struct mp_map_replace_ { using K = mp_first; - // mp_replace_if is inlined here using a struct _f because of msvc-14.0 +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template struct _f { using type = mp_if< std::is_same, K>, T, V >; }; using type = mp_if< mp_map_contains, K>, M::type...>, M >; + +#else + + template using _f = mp_if< std::is_same, K>, T, V >; + + using type = mp_if< mp_map_contains, K>, M<_f...>, M >; + +#endif }; } // namespace detail @@ -53,14 +61,37 @@ template using mp_map_replace = typename detail::mp_map_replac namespace detail { +#if ! BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) + +template struct mp_map_update_impl_f +{ + template using _f = std::is_same, mp_first>; +}; + +template class F> struct mp_map_update_impl_f3 +{ + // _f3> -> L> + template using _f3 = mp_assign, mp_rename > >; +}; + +#endif + template class F> struct mp_map_update_impl { +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) + template using _f = std::is_same, mp_first>; // _f3> -> L> template using _f3 = mp_assign, mp_rename > >; using type = mp_if< mp_map_contains>, mp_transform_if<_f, _f3, M>, mp_push_back >; + +#else + + using type = mp_if< mp_map_contains>, mp_transform_if::template _f, mp_map_update_impl_f3::template _f3, M>, mp_push_back >; + +#endif }; } // namespace detail @@ -72,10 +103,14 @@ template using mp_map_update_q = mp_map_update struct mp_map_erase_impl +template struct mp_map_erase_impl_f { template using _f = std::is_same, K>; - using type = mp_remove_if; +}; + +template struct mp_map_erase_impl +{ + using type = mp_remove_if::template _f>; }; } // namespace detail