diff --git a/include/boost/mp11/detail/mp_map_find.hpp b/include/boost/mp11/detail/mp_map_find.hpp index 2fb70d8..035538a 100644 --- a/include/boost/mp11/detail/mp_map_find.hpp +++ b/include/boost/mp11/detail/mp_map_find.hpp @@ -11,6 +11,14 @@ #include #include +#if BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, >= 140000 ) + +#include +#include +#include + +#endif + #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1930 ) // not exactly good practice, but... @@ -26,6 +34,30 @@ namespace boost namespace mp11 { +#if BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, >= 140000 ) + +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120161 + +namespace detail +{ + +template struct mp_map_find_impl; + +template class M, class... T, class K> struct mp_map_find_impl, K> +{ + template using _f = mp_if, K>, mp_list, mp_list<>>; + + using _l = mp_append<_f..., mp_list>; + + using type = mp_front<_l>; +}; + +} // namespace detail + +template using mp_map_find = typename detail::mp_map_find_impl::type; + +#else + // mp_map_find namespace detail { @@ -81,6 +113,8 @@ template class M, class... T, class K> struct mp_map_find_imp template using mp_map_find = typename detail::mp_map_find_impl::type; +#endif + } // namespace mp11 } // namespace boost