]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/type_erasure/detail/get_placeholders.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / type_erasure / detail / get_placeholders.hpp
1 // Boost.TypeErasure library
2 //
3 // Copyright 2011 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_GET_PLACEHOLDERS_HPP_INCLUDED
14 #define BOOST_TYPE_ERASURE_DETAIL_GET_PLACEHOLDERS_HPP_INCLUDED
15
16 #include <boost/mpl/eval_if.hpp>
17 #include <boost/mpl/identity.hpp>
18 #include <boost/mpl/insert.hpp>
19 #include <boost/preprocessor/cat.hpp>
20 #include <boost/preprocessor/iteration/iterate.hpp>
21 #include <boost/preprocessor/repetition/enum.hpp>
22 #include <boost/preprocessor/repetition/enum_params.hpp>
23 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
24 #include <boost/type_erasure/config.hpp>
25 #include <boost/type_erasure/is_placeholder.hpp>
26
27 namespace boost {
28 namespace type_erasure {
29 namespace detail {
30
31 template<class T, class Out>
32 struct get_placeholders_in_argument
33 {
34 typedef typename ::boost::mpl::eval_if<
35 ::boost::type_erasure::is_placeholder<T>,
36 ::boost::mpl::insert<Out, T>,
37 ::boost::mpl::identity<Out>
38 >::type type;
39 };
40
41 template<class T, class Out>
42 struct get_placeholders;
43
44 template<class T, class Out>
45 struct get_placeholders_in_argument<T&, Out>
46 {
47 typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument<
48 T,
49 Out
50 >::type type;
51 };
52
53 template<class T, class Out>
54 struct get_placeholders_in_argument<const T, Out>
55 {
56 typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument<
57 T,
58 Out
59 >::type type;
60 };
61
62 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
63
64 template<class Out, class... T>
65 struct get_placeholders_impl;
66
67 template<class Out, class T0, class... T>
68 struct get_placeholders_impl<Out, T0, T...>
69 {
70 typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument<
71 T0,
72 typename get_placeholders_impl<Out, T...>::type
73 >::type type;
74 };
75
76 template<class Out>
77 struct get_placeholders_impl<Out>
78 {
79 typedef Out type;
80 };
81
82 template<template<class...> class T, class... U, class Out>
83 struct get_placeholders<T<U...>, Out>
84 {
85 typedef typename get_placeholders_impl<Out, U...>::type type;
86 };
87
88 template<class R, class... T, class Out>
89 struct get_placeholders_in_argument<R(T...), Out>
90 {
91 typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument<
92 R,
93 Out
94 >::type type0;
95 typedef typename get_placeholders_impl<type0, T...>::type type;
96 };
97
98 #else
99
100 #define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/get_placeholders.hpp>
101 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY)
102 #include BOOST_PP_ITERATE()
103
104 #endif
105
106 }
107 }
108 }
109
110 #endif
111
112 #else
113
114 #define N BOOST_PP_ITERATION()
115 #define BOOST_TYPE_ERASURE_GET_PLACEHOLDER(z, n, data) \
116 typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< \
117 BOOST_PP_CAT(data, n), BOOST_PP_CAT(type, n)>::type \
118 BOOST_PP_CAT(type, BOOST_PP_INC(n));
119
120 #if N != 0
121
122 template<template<BOOST_PP_ENUM_PARAMS(N, class T)> class T,
123 BOOST_PP_ENUM_PARAMS(N, class T), class Out>
124 struct get_placeholders<T<BOOST_PP_ENUM_PARAMS(N, T)>, Out>
125 {
126 typedef Out type0;
127 BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_GET_PLACEHOLDER, T)
128 typedef BOOST_PP_CAT(type, N) type;
129 };
130
131 #endif
132
133 template<class R
134 BOOST_PP_ENUM_TRAILING_PARAMS(N, class T), class Out>
135 struct get_placeholders_in_argument<R(BOOST_PP_ENUM_PARAMS(N, T)), Out>
136 {
137 typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument<
138 R,
139 Out
140 >::type type0;
141 BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_GET_PLACEHOLDER, T)
142 typedef BOOST_PP_CAT(type, N) type;
143 };
144
145 #undef BOOST_TYPE_ERASURE_GET_PLACEHOLDER
146 #undef N
147
148 #endif