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)
7 #ifndef BOOST_PARAMETER_PREPROCESSOR_060206_HPP
8 #define BOOST_PARAMETER_PREPROCESSOR_060206_HPP
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>
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)
21 #include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
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)< \
28 >::type BOOST_PARAMETER_FUNCTION_IMPL_NAME(name, is_const)( \
33 #include <boost/parameter/aux_/preprocessor/impl/parenthesized_return_type.hpp>
34 #include <boost/parameter/config.hpp>
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);
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) \
52 BOOST_PARAMETER_SPECIFICATION(tag_ns, name, args, is_const) \
53 BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME(name, is_const);
55 #endif // BOOST_PARAMETER_CAN_USE_MP11
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)
65 #include <boost/preprocessor/control/expr_if.hpp>
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)
77 #include <boost/parameter/aux_/preprocessor/impl/flatten.hpp>
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) \
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) \
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 \
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 \
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 \
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 \
133 #include <boost/parameter/aux_/preprocessor/impl/function_dispatch_layer.hpp>
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) \
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) \
154 #include <boost/preprocessor/control/if.hpp>
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( \
166 , BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args) \
168 BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(impl) \
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) \
187 // Expands to a Boost.Parameter-enabled const-qualified member function
188 // header. All arguments are accessible via args and keywords, as well as
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) \
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) \
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
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) \
216 #endif // include guard