]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/parameter/test/earwicker.cpp
1 // Copyright David Abrahams, Daniel Wallin 2005.
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(w
)
22 BOOST_PARAMETER_NAME(x
)
23 BOOST_PARAMETER_NAME(y
)
24 BOOST_PARAMETER_NAME(z
)
27 #if !defined(BOOST_PARAMETER_CAN_USE_MP11)
28 #include <boost/mpl/bool.hpp>
29 #include <boost/mpl/if.hpp>
30 #include <boost/type_traits/is_convertible.hpp>
36 template <typename T
, typename Args
>
39 boost::is_convertible
<T
,int>
48 #endif // BOOST_PARAMETER_CAN_USE_MP11
50 #include <boost/parameter/parameters.hpp>
52 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
53 #include <boost/mp11/bind.hpp>
54 #include <type_traits>
59 struct f_parameters
// vc6 is happier with inheritance than with a typedef
60 : boost::parameter::parameters
<
61 boost::parameter::required
<test::tag::w
>
62 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
63 , boost::parameter::optional
<
65 , boost::mp11::mp_bind
<std::is_convertible
,boost::mp11::_1
,int>
67 , boost::parameter::optional
<
69 , boost::mp11::mp_bind
<std::is_convertible
,boost::mp11::_1
,int>
71 , boost::parameter::optional
<
73 , boost::mp11::mp_bind
<std::is_convertible
,boost::mp11::_1
,int>
76 , boost::parameter::optional
<test::tag::x
,test::f_predicate
>
77 , boost::parameter::optional
<test::tag::y
,test::f_predicate
>
78 , boost::parameter::optional
<test::tag::z
,test::f_predicate
>
79 #endif // BOOST_PARAMETER_CAN_USE_MP11
85 #include <boost/parameter/macros.hpp>
86 #include <boost/core/lightweight_test.hpp>
90 #if defined(BOOST_NO_VOID_RETURNS)
91 BOOST_PARAMETER_FUN(int, f
, 1, 4, f_parameters
)
93 BOOST_PARAMETER_FUN(void, f
, 1, 4, f_parameters
)
96 BOOST_TEST_EQ(p
[test::_w
][0], p
[test::_x
| -1]);
97 BOOST_TEST_EQ(p
[test::_w
][1], p
[test::_y
| -2]);
98 BOOST_TEST_EQ(p
[test::_w
][2], p
[test::_z
| -3]);
99 #if defined(BOOST_NO_VOID_RETURNS)
111 test::f(test::_x
= 1, test::_y
= 2, test::_z
= 3, test::_w
= a
);
114 test::f(test::_x
= 1, test::_w
= a
);
117 test::f(test::_y
= 2, test::_w
= a
);
120 test::f(test::_z
= 3, test::_w
= a
);
122 test::f(test::_z
= 3, test::_x
= 1, test::_w
= a
);
123 return boost::report_errors();