// Boost.TypeErasure library // // Copyright 2012 Steven Watanabe // // 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) // // $Id$ #ifndef BOOST_TYPE_ERASURE_DETAIL_CHECK_MAP_HPP_INCLUDED #define BOOST_TYPE_ERASURE_DETAIL_CHECK_MAP_HPP_INCLUDED #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace type_erasure { namespace detail { template struct is_deduced : boost::mpl::false_ {}; template struct is_deduced< ::boost::type_erasure::deduced > : boost::mpl::true_ {}; // returns true if Map has a key for every non-deduced placeholder in Concept template struct check_map { #ifndef BOOST_TYPE_ERASURE_USE_MP11 typedef typename normalize_concept::basic basic_components; typedef typename ::boost::mpl::fold< basic_components, ::boost::mpl::set0<>, ::boost::type_erasure::detail::get_placeholders< ::boost::mpl::_2, ::boost::mpl::_1 > >::type placeholders; // Every non-deduced placeholder referenced in this // map is indirectly deduced. typedef typename ::boost::type_erasure::detail::get_placeholder_normalization_map< Concept>::type placeholder_subs; typedef typename ::boost::mpl::fold< placeholder_subs, ::boost::mpl::set0<>, ::boost::mpl::insert< ::boost::mpl::_1, ::boost::mpl::second< ::boost::mpl::_2> > >::type indirect_deduced_placeholders; typedef typename ::boost::is_same< typename ::boost::mpl::find_if< placeholders, ::boost::mpl::not_< ::boost::mpl::or_< ::boost::type_erasure::detail::is_deduced< ::boost::mpl::_1>, ::boost::mpl::has_key, ::boost::mpl::has_key > > >::type, typename ::boost::mpl::end::type >::type type; #else typedef ::boost::type_erasure::detail::get_all_placeholders< ::boost::type_erasure::detail::normalize_concept_t > placeholders; // Every non-deduced placeholder referenced in this // map is indirectly deduced. typedef typename ::boost::type_erasure::detail::get_placeholder_normalization_map< Concept>::type placeholder_subs; typedef ::boost::mp11::mp_unique< ::boost::mp11::mp_append< ::boost::mp11::mp_transform< ::boost::mp11::mp_first, ::boost::type_erasure::detail::make_mp_list >, ::boost::mp11::mp_transform< ::boost::mp11::mp_second, ::boost::type_erasure::detail::make_mp_list > > > okay_placeholders; template using check_placeholder = ::boost::mpl::or_< ::boost::type_erasure::detail::is_deduced

, ::boost::mp11::mp_set_contains >; typedef ::boost::mp11::mp_all_of type; #endif }; template struct check_map > : check_map {}; } } } #endif