From 946861bb63c662b1266abaafd7140e0716f1a0e0 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 24 Mar 2017 18:47:55 +0200 Subject: [PATCH] Make mp_replace(_if) SFINAE-friendlier. --- include/boost/mp11/algorithm.hpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index d71b77c..0cfafc2 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -337,27 +337,18 @@ template using mp_take = typename detail::mp_take_impl:: namespace detail { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) - template struct mp_replace_impl; template class L, class... T, class V, class W> struct mp_replace_impl, V, W> { +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 ) template struct _f { using type = mp_if, W, A>; }; - using type = L::type...>; -}; - #else - -template struct mp_replace_impl -{ template using _f = mp_if, W, A>; - - using type = mp_transform<_f, L>; -}; - + using type = L<_f...>; #endif +}; } // namespace detail @@ -367,11 +358,12 @@ template using mp_replace = typename detail::mp_repla namespace detail { -template class P, class W> struct mp_replace_if_impl -{ - template using _f = mp_if, W, T>; +template class P, class W> struct mp_replace_if_impl; - using type = mp_transform<_f, L>; +template class L, class... T, template class P, class W> struct mp_replace_if_impl, P, W> +{ + template using _f = mp_if, W, U>; + using type = L<_f...>; }; } // namespace detail