]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/parameter/preprocessor.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / parameter / preprocessor.hpp
1 // Copyright Daniel Wallin 2006.
2 // Copyright Cromwell D. Enage 2017.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 #ifndef BOOST_PARAMETER_PREPROCESSOR_060206_HPP
8 #define BOOST_PARAMETER_PREPROCESSOR_060206_HPP
9
10 #include <boost/parameter/aux_/preprocessor/impl/forwarding_overloads.hpp>
11 #include <boost/parameter/aux_/preprocessor/impl/specification.hpp>
12 #include <boost/preprocessor/cat.hpp>
13
14 // Helper macro for BOOST_PARAMETER_CONSTRUCTOR.
15 #define BOOST_PARAMETER_CONSTRUCTOR_AUX(class_, base, tag_namespace, args) \
16 BOOST_PARAMETER_SPECIFICATION(tag_namespace, ctor, args, 0) \
17 BOOST_PP_CAT(constructor_parameters, __LINE__); \
18 BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS(class_, base, args)
19 /**/
20
21 #include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
22
23 // Defines the implementation function header.
24 #define BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name, is_const) \
25 template <typename Args> \
26 typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name, is_const)< \
27 Args \
28 >::type BOOST_PARAMETER_FUNCTION_IMPL_NAME(name, is_const)( \
29 Args const& args \
30 )
31 /**/
32
33 #include <boost/parameter/aux_/preprocessor/impl/parenthesized_return_type.hpp>
34 #include <boost/parameter/config.hpp>
35
36 // Expands to the result metafunction and the parameters specialization.
37 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
38 #define BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_ns, args, is_const) \
39 template <typename Args> \
40 using BOOST_PARAMETER_FUNCTION_RESULT_NAME(name, is_const) \
41 = typename BOOST_PARAMETER_PARENTHESIZED_RETURN_TYPE(result); \
42 BOOST_PARAMETER_SPECIFICATION(tag_ns, name, args, is_const) \
43 BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME(name, is_const);
44 /**/
45 #else
46 #define BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_ns, args, is_const) \
47 template <typename Args> \
48 struct BOOST_PARAMETER_FUNCTION_RESULT_NAME(name, is_const) \
49 : BOOST_PARAMETER_PARENTHESIZED_RETURN_TYPE(result) \
50 { \
51 }; \
52 BOOST_PARAMETER_SPECIFICATION(tag_ns, name, args, is_const) \
53 BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME(name, is_const);
54 /**/
55 #endif // BOOST_PARAMETER_CAN_USE_MP11
56
57 // Helper macro for BOOST_PARAMETER_BASIC_FUNCTION.
58 #define BOOST_PARAMETER_BASIC_FUNCTION_AUX(result, name, tag_ns, args) \
59 BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_ns, args, 0) \
60 BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name, 0); \
61 BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, name, args, 0, 0) \
62 BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name, 0)
63 /**/
64
65 #include <boost/preprocessor/control/expr_if.hpp>
66
67 // Helper macro for BOOST_PARAMETER_BASIC_MEMBER_FUNCTION,
68 // BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION,
69 // BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR, and
70 // BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR.
71 #define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX(r, n, i, tag_ns, args, c) \
72 BOOST_PARAMETER_FUNCTION_HEAD(r, i, tag_ns, args, c) \
73 BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(n, i, args, 1, c) \
74 BOOST_PARAMETER_FUNCTION_IMPL_HEAD(i, c) BOOST_PP_EXPR_IF(c, const)
75 /**/
76
77 #include <boost/parameter/aux_/preprocessor/impl/flatten.hpp>
78
79 // Expands to a Boost.Parameter-enabled constructor header. All arguments are
80 // accessible via args and keywords only.
81 #define BOOST_PARAMETER_CONSTRUCTOR(class_, base, tag_namespace, args) \
82 BOOST_PARAMETER_CONSTRUCTOR_AUX( \
83 class_, base, tag_namespace \
84 , BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args) \
85 )
86 /**/
87
88 // Expands to a Boost.Parameter-enabled function header. All arguments are
89 // accessible via args and keywords only.
90 #define BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, args) \
91 BOOST_PARAMETER_BASIC_FUNCTION_AUX( \
92 result, name, tag_namespace \
93 , BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args) \
94 )
95 /**/
96
97 // Expands to a Boost.Parameter-enabled member function header. All arguments
98 // are accessible via args and keywords only.
99 #define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, args) \
100 BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
101 result, name, name, tag_ns \
102 , BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 0 \
103 )
104 /**/
105
106 // Expands to a Boost.Parameter-enabled const-qualified member function
107 // header. All arguments are accessible via args and keywords only.
108 #define BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(r, name, tag_ns, args) \
109 BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
110 r, name, name, tag_ns \
111 , BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 1 \
112 )
113 /**/
114
115 // Expands to a Boost.Parameter-enabled function call operator header. All
116 // arguments are accessible via args and keywords only.
117 #define BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR(result, tag_ns, args) \
118 BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
119 result, operator(), operator, tag_ns \
120 , BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 0 \
121 )
122 /**/
123
124 // Expands to a Boost.Parameter-enabled const-qualified function call
125 // operator header. All arguments are accessible via args and keywords only.
126 #define BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR(r, tag_ns, args) \
127 BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
128 r, operator(), operator, tag_ns \
129 , BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 1 \
130 )
131 /**/
132
133 #include <boost/parameter/aux_/preprocessor/impl/function_dispatch_layer.hpp>
134
135 // Helper macro for BOOST_PARAMETER_FUNCTION.
136 #define BOOST_PARAMETER_FUNCTION_AUX(result, name, tag_ns, args) \
137 BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_ns, args, 0) \
138 BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name, 0); \
139 BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, name, args, 0, 0) \
140 BOOST_PARAMETER_FUNCTION_DISPATCH_LAYER( \
141 1, (name, BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args), 0, 0, tag_ns) \
142 )
143 /**/
144
145 // Expands to a Boost.Parameter-enabled function header. All arguments are
146 // accessible via args and keywords, as well as by name.
147 #define BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, args) \
148 BOOST_PARAMETER_FUNCTION_AUX( \
149 result, name, tag_namespace \
150 , BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
151 )
152 /**/
153
154 #include <boost/preprocessor/control/if.hpp>
155
156 // Helper macro for BOOST_PARAMETER_MEMBER_FUNCTION
157 // BOOST_PARAMETER_CONST_MEMBER_FUNCTION,
158 // BOOST_PARAMETER_FUNCTION_CALL_OPERATOR, and
159 // BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR.
160 #define BOOST_PARAMETER_MEMBER_FUNCTION_AUX(r, name, impl, tag_ns, c, args) \
161 BOOST_PARAMETER_FUNCTION_HEAD(r, impl, tag_ns, args, c) \
162 BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, args, 1, c) \
163 BOOST_PARAMETER_FUNCTION_DISPATCH_LAYER( \
164 0, ( \
165 impl \
166 , BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args) \
167 , BOOST_PP_IF( \
168 BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(impl) \
169 , 0 \
170 , 1 \
171 ) \
172 , c \
173 , tag_ns \
174 ) \
175 )
176 /**/
177
178 // Expands to a Boost.Parameter-enabled member function header. All
179 // arguments are accessible via args and keywords, as well as by name.
180 #define BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_ns, args) \
181 BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
182 result, name, name, tag_ns, 0 \
183 , BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
184 )
185 /**/
186
187 // Expands to a Boost.Parameter-enabled const-qualified member function
188 // header. All arguments are accessible via args and keywords, as well as
189 // by name.
190 #define BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_ns, args) \
191 BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
192 result, name, name, tag_ns, 1 \
193 , BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
194 )
195 /**/
196
197 // Expands to a Boost.Parameter-enabled function call operator header. All
198 // arguments are accessible via args and keywords, as well as by name.
199 #define BOOST_PARAMETER_FUNCTION_CALL_OPERATOR(result, tag_ns, args) \
200 BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
201 result, operator(), operator, tag_ns, 0 \
202 , BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
203 )
204 /**/
205
206 // Expands to a Boost.Parameter-enabled const-qualified function call operator
207 // header. All arguments are accessible via args and keywords, as well as
208 // by name.
209 #define BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, args) \
210 BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
211 result, operator(), operator, tag_ns, 1 \
212 , BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
213 )
214 /**/
215
216 #endif // include guard
217