1 // Boost.TypeErasure library
3 // Copyright 2012 Steven Watanabe
5 // Distributed under the Boost Software License Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_TYPE_ERASURE_DETAIL_CHECK_MAP_HPP_INCLUDED
12 #define BOOST_TYPE_ERASURE_DETAIL_CHECK_MAP_HPP_INCLUDED
14 #include <boost/mpl/not.hpp>
15 #include <boost/mpl/or.hpp>
16 #include <boost/mpl/bool.hpp>
17 #include <boost/mpl/set.hpp>
18 #include <boost/mpl/has_key.hpp>
19 #include <boost/mpl/find_if.hpp>
20 #include <boost/mpl/end.hpp>
21 #include <boost/type_traits/is_same.hpp>
22 #include <boost/type_erasure/detail/get_placeholders.hpp>
23 #include <boost/type_erasure/deduced.hpp>
24 #include <boost/type_erasure/static_binding.hpp>
27 namespace type_erasure {
31 struct is_deduced : boost::mpl::false_ {};
33 struct is_deduced< ::boost::type_erasure::deduced<T> > : boost::mpl::true_ {};
35 // returns true if Map has a key for every non-deduced placeholder in Concept
36 template<class Concept, class Map>
38 typedef typename normalize_concept<Concept>::basic basic_components;
40 // Every non-deduced placeholder referenced in this
41 // map is indirectly deduced.
42 typedef typename ::boost::type_erasure::detail::get_placeholder_normalization_map<
43 Concept>::type placeholder_subs;
44 typedef typename ::boost::mpl::fold<
49 ::boost::mpl::second< ::boost::mpl::_2>
51 >::type indirect_deduced_placeholders;
53 typedef typename ::boost::mpl::fold<
56 ::boost::type_erasure::detail::get_placeholders<
61 typedef typename ::boost::is_same<
62 typename ::boost::mpl::find_if<
66 ::boost::type_erasure::detail::is_deduced< ::boost::mpl::_1>,
67 ::boost::mpl::has_key<Map, ::boost::mpl::_1>,
68 ::boost::mpl::has_key<indirect_deduced_placeholders, ::boost::mpl::_1>
72 typename ::boost::mpl::end<placeholders>::type
76 template<class Concept, class Map>
77 struct check_map<Concept, ::boost::type_erasure::static_binding<Map> > :
78 check_map<Concept, Map>