1 // Copyright Cromwell D. Enage 2017.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/parameter/config.hpp>
8 #if (BOOST_PARAMETER_MAX_ARITY < 4)
9 #error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
11 #if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
12 (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 5)
13 #error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
17 #include <boost/parameter/name.hpp>
21 BOOST_PARAMETER_NAME((_lrc0
, keywords
) in(lrc0
))
22 BOOST_PARAMETER_NAME((_lr0
, keywords
) in_out(lr0
))
23 BOOST_PARAMETER_NAME((_rrc0
, keywords
) in(rrc0
))
24 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
25 BOOST_PARAMETER_NAME((_rr0
, keywords
) consume(rr0
))
27 BOOST_PARAMETER_NAME((_rr0
, keywords
) rr0
)
31 #include <boost/parameter/parameters.hpp>
32 #include <boost/parameter/required.hpp>
37 : boost::parameter::parameters
<
38 boost::parameter::required
<test::keywords::lrc0
>
39 , boost::parameter::required
<test::keywords::lr0
>
40 , boost::parameter::required
<test::keywords::rrc0
>
41 , boost::parameter::required
<test::keywords::rr0
>
47 #include <boost/core/lightweight_test.hpp>
48 #include "evaluate_category.hpp"
50 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
51 #include <type_traits>
53 #include <boost/type_traits/is_scalar.hpp>
61 template <typename Args
>
62 static void evaluate(Args
const& args
)
65 test::passed_by_lvalue_reference_to_const
66 , test::A
<T
>::evaluate_category(args
[test::_lrc0
])
69 test::passed_by_lvalue_reference
70 , test::A
<T
>::evaluate_category(args
[test::_lr0
])
72 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
74 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
75 if (std::is_scalar
<T
>::value
)
77 if (boost::is_scalar
<T
>::value
)
81 test::passed_by_lvalue_reference_to_const
82 , test::A
<T
>::evaluate_category(args
[test::_rrc0
])
85 test::passed_by_lvalue_reference_to_const
86 , test::A
<T
>::evaluate_category(args
[test::_rr0
])
92 test::passed_by_rvalue_reference_to_const
93 , test::A
<T
>::evaluate_category(args
[test::_rrc0
])
96 test::passed_by_rvalue_reference
97 , test::A
<T
>::evaluate_category(args
[test::_rr0
])
100 #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
102 test::passed_by_lvalue_reference_to_const
103 , test::A
<T
>::evaluate_category(args
[test::_rrc0
])
106 test::passed_by_lvalue_reference_to_const
107 , test::A
<T
>::evaluate_category(args
[test::_rr0
])
109 #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
114 #include <boost/parameter/deduced.hpp>
115 #include <boost/mpl/bool.hpp>
116 #include <boost/mpl/placeholders.hpp>
117 #include <boost/mpl/if.hpp>
118 #include <boost/type_traits/is_convertible.hpp>
120 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
121 #include <boost/mp11/bind.hpp>
127 : boost::parameter::parameters
<
128 boost::parameter::required
<
129 boost::parameter::deduced
<test::keywords::lrc0
>
130 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
131 , boost::mp11::mp_bind
<
138 boost::is_convertible
<boost::mpl::_1
,float>
144 , boost::parameter::required
<
145 boost::parameter::deduced
<test::keywords::lr0
>
147 boost::is_convertible
<boost::mpl::_1
,char const*>
152 , boost::parameter::required
<
153 boost::parameter::deduced
<test::keywords::rr0
>
154 , test::string_predicate
<test::keywords::lr0
>
161 #include <boost/parameter/value_type.hpp>
163 #if !defined(BOOST_PARAMETER_CAN_USE_MP11)
164 #include <boost/type_traits/remove_const.hpp>
171 template <typename Args
>
172 static void evaluate(Args
const& args
)
174 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
176 test::passed_by_lvalue_reference_to_const
== test::A
<
177 typename
std::remove_const
<
178 typename
boost::parameter::value_type
<
180 , test::keywords::lrc0
183 >::evaluate_category(args
[test::_lrc0
])
186 test::passed_by_lvalue_reference
== test::A
<
187 typename
std::remove_const
<
188 typename
boost::parameter::value_type
<
190 , test::keywords::lr0
193 >::evaluate_category(args
[test::_lr0
])
195 #else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
197 test::passed_by_lvalue_reference_to_const
== test::A
<
198 typename
boost::remove_const
<
199 typename
boost::parameter::value_type
<
201 , test::keywords::lrc0
204 >::evaluate_category(args
[test::_lrc0
])
207 test::passed_by_lvalue_reference
== test::A
<
208 typename
boost::remove_const
<
209 typename
boost::parameter::value_type
<
211 , test::keywords::lr0
214 >::evaluate_category(args
[test::_lr0
])
216 #endif // BOOST_PARAMETER_CAN_USE_MP11
218 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
220 test::passed_by_rvalue_reference
== test::A
<
221 typename
std::remove_const
<
222 typename
boost::parameter::value_type
<
224 , test::keywords::rr0
227 >::evaluate_category(args
[test::_rr0
])
229 #elif defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
231 test::passed_by_rvalue_reference
== test::A
<
232 typename
boost::remove_const
<
233 typename
boost::parameter::value_type
<
235 , test::keywords::rr0
238 >::evaluate_category(args
[test::_rr0
])
240 #else // no MP11 or perfect forwarding support
242 test::passed_by_lvalue_reference_to_const
== test::A
<
243 typename
boost::remove_const
<
244 typename
boost::parameter::value_type
<
246 , test::keywords::rr0
249 >::evaluate_category(args
[test::_rr0
])
251 #endif // MP11 or perfect forwarding support
258 test::B
<float>::evaluate(
259 test::f_parameters()(
260 test::lvalue_const_float()
261 , test::lvalue_float()
262 , test::rvalue_const_float()
263 , test::rvalue_float()
266 test::B
<char const*>::evaluate(
267 test::f_parameters()(
268 test::lvalue_const_char_ptr()
269 , test::lvalue_char_ptr()
270 , test::rvalue_const_char_ptr()
271 , test::rvalue_char_ptr()
274 test::B
<std::string
>::evaluate(
275 test::f_parameters()(
276 test::lvalue_const_str()
278 , test::rvalue_const_str()
282 test::B
<float>::evaluate((
283 test::_lr0
= test::lvalue_float()
284 , test::_rrc0
= test::rvalue_const_float()
285 , test::_rr0
= test::rvalue_float()
286 , test::_lrc0
= test::lvalue_const_float()
288 test::B
<char const*>::evaluate((
289 test::_lr0
= test::lvalue_char_ptr()
290 , test::_rrc0
= test::rvalue_const_char_ptr()
291 , test::_rr0
= test::rvalue_char_ptr()
292 , test::_lrc0
= test::lvalue_const_char_ptr()
294 test::B
<std::string
>::evaluate((
295 test::_lr0
= test::lvalue_str()
296 , test::_rrc0
= test::rvalue_const_str()
297 , test::_rr0
= test::rvalue_str()
298 , test::_lrc0
= test::lvalue_const_str()
301 char baz_arr
[4] = "qux";
302 typedef char char_arr
[4];
304 #if !defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_VENDOR_SPECIFIC) && \
305 BOOST_WORKAROUND(BOOST_MSVC, >= 1800)
306 // MSVC-12+ treats static_cast<char_arr&&>(baz_arr) as an lvalue.
308 test::B
<char_arr
>::evaluate(
309 test::f_parameters()(
312 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
313 , static_cast<char_arr
const&&>("uir")
314 , static_cast<char_arr
&&>(baz_arr
)
321 test::B
<char_arr
>::evaluate((
323 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
324 , test::_rrc0
= static_cast<char_arr
const&&>("wld")
325 , test::_rr0
= static_cast<char_arr
&&>(baz_arr
)
327 , test::_rrc0
= "frd"
330 , test::_lrc0
= "mos"
335 test::e_parameters()(
336 test::lvalue_char_ptr()
338 , test::lvalue_const_float()
342 test::e_parameters()(
344 , test::lvalue_const_float()
345 , test::lvalue_char_ptr()
348 return boost::report_errors();