#ifndef BOOST_MP11_MAP_HPP_INCLUDED #define BOOST_MP11_MAP_HPP_INCLUDED // Copyright 2015-2017 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt #include #include #include #include #include #include #include #include namespace boost { namespace mp11 { // mp_map_contains template using mp_map_contains = mp_not, void>>; // mp_map_insert template using mp_map_insert = mp_if< mp_map_contains>, M, mp_push_back >; // mp_map_replace namespace detail { template struct mp_map_replace_impl; template class M, class... U, class T> struct mp_map_replace_impl, T> { using K = mp_first; #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 using type = mp_if< mp_map_contains, K>, M, K>, T, U >...>, M >; #endif }; } // namespace detail template using mp_map_replace = typename detail::mp_map_replace_impl::type; // mp_map_update namespace detail { template struct mp_map_update_impl_f { template using fn = std::is_same, mp_first>; }; template class F> struct mp_map_update_impl_f3 { // fn> -> L> template using fn = mp_assign, mp_rename > >; }; template class F> struct mp_map_update_impl { using type = mp_if< mp_map_contains>, mp_transform_if_q, mp_map_update_impl_f3, M>, mp_push_back >; }; } // namespace detail template class F> using mp_map_update = typename detail::mp_map_update_impl::type; template using mp_map_update_q = mp_map_update; // mp_map_erase namespace detail { template struct mp_map_erase_impl_f { template using fn = std::is_same, K>; }; } // namespace detail template using mp_map_erase = mp_remove_if_q< M, detail::mp_map_erase_impl_f >; // mp_map_keys template using mp_map_keys = mp_transform; // mp_is_map namespace detail { template struct mp_is_map_element: mp_false { }; template class L, class T1, class... T> struct mp_is_map_element>: mp_true { }; template using mp_keys_are_set = mp_is_set>; template struct mp_is_map_impl { using type = mp_false; }; template class M, class... T> struct mp_is_map_impl> { using type = mp_eval_if...>>, mp_false, mp_keys_are_set, M>; }; } // namespace detail template using mp_is_map = typename detail::mp_is_map_impl::type; } // namespace mp11 } // namespace boost #endif // #ifndef BOOST_MP11_MAP_HPP_INCLUDED