]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/type_erasure/detail/instantiate.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / type_erasure / detail / instantiate.hpp
1 // Boost.TypeErasure library
2 //
3 // Copyright 2012 Steven Watanabe
4 //
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)
8 //
9 // $Id$
10
11 #if !defined(BOOST_PP_IS_ITERATING)
12
13 #ifndef BOOST_TYPE_ERASURE_DETAIL_INSTANTIATE_HPP_INCLUDED
14 #define BOOST_TYPE_ERASURE_DETAIL_INSTANTIATE_HPP_INCLUDED
15
16 #include <boost/mpl/transform.hpp>
17 #include <boost/mpl/size.hpp>
18 #include <boost/mpl/at.hpp>
19 #include <boost/preprocessor/cat.hpp>
20 #include <boost/preprocessor/iteration/iterate.hpp>
21 #include <boost/preprocessor/repetition/repeat.hpp>
22 #include <boost/preprocessor/repetition/enum.hpp>
23 #include <boost/preprocessor/repetition/enum_params.hpp>
24 #include <boost/type_erasure/detail/normalize.hpp>
25 #include <boost/type_erasure/detail/rebind_placeholders.hpp>
26
27 namespace boost {
28 namespace type_erasure {
29 namespace detail {
30
31 template<int N>
32 struct make_instantiate_concept_impl;
33
34 template<class Concept>
35 struct make_instantiate_concept {
36 typedef typename ::boost::type_erasure::detail::normalize_concept<
37 Concept>::type normalized;
38 typedef typename ::boost::type_erasure::detail::make_instantiate_concept_impl<
39 (::boost::mpl::size<normalized>::value)
40 >::type type;
41 };
42
43 #define BOOST_TYPE_ERASURE_INSTANTIATE(Concept, Map) \
44 (::boost::type_erasure::detail::make_instantiate_concept< \
45 Concept \
46 >::type::apply((Concept*)0, (Map*)0))
47
48 #define BOOST_TYPE_ERASURE_INSTANTIATE1(Concept, P0, T0) \
49 (::boost::type_erasure::detail::make_instantiate_concept< \
50 Concept \
51 >::type::apply( \
52 (Concept*)0, \
53 (::boost::mpl::map1< ::boost::mpl::pair<P0, T0> >*)0))
54
55 #define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/instantiate.hpp>
56 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_FUNCTIONS)
57 #include BOOST_PP_ITERATE()
58
59 }
60 }
61 }
62
63 #endif
64
65 #else
66
67 #define N BOOST_PP_ITERATION()
68
69 #define BOOST_TYPE_ERASURE_INSTANTIATE_IMPL(z, n, data)\
70 (void)&::boost::mpl::at_c<data, n>::type::apply;
71
72 struct BOOST_PP_CAT(instantiate_concept, N) {
73 template<class Concept, class Map>
74 static void apply(Concept *, Map *) {
75 typedef typename ::boost::type_erasure::detail::normalize_concept<
76 Concept>::type normalized;
77 typedef typename ::boost::type_erasure::detail::get_placeholder_normalization_map<
78 Concept
79 >::type placeholder_subs;
80
81 typedef typename ::boost::mpl::transform<
82 normalized,
83 ::boost::type_erasure::detail::rebind_placeholders<
84 ::boost::mpl::_1,
85 typename ::boost::type_erasure::detail::add_deductions<
86 Map,
87 placeholder_subs
88 >::type
89 >
90 >::type concept_sequence;
91 BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_INSTANTIATE_IMPL, concept_sequence)
92 }
93 };
94
95 template<>
96 struct make_instantiate_concept_impl<N>
97 {
98 typedef ::boost::type_erasure::detail::BOOST_PP_CAT(instantiate_concept, N) type;
99 };
100
101 #undef BOOST_TYPE_ERASURE_INSTANTIATE_IMPL
102
103 #undef N
104
105 #endif