]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/parameter/test/earwicker.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / parameter / test / earwicker.cpp
1 // Copyright David Abrahams, Daniel Wallin 2005. Use, modification and
2 // distribution is subject to 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)
5
6 #include <boost/parameter.hpp>
7 #include <boost/type_traits/is_convertible.hpp>
8 #include <boost/mpl/placeholders.hpp>
9 #include <iostream>
10
11 namespace test {
12
13 BOOST_PARAMETER_KEYWORD(tag, x)
14 BOOST_PARAMETER_KEYWORD(tag, y)
15 BOOST_PARAMETER_KEYWORD(tag, z)
16
17 using namespace boost::parameter;
18 using namespace boost::mpl::placeholders;
19
20 struct f_parameters // vc6 is happier with inheritance than with a typedef
21 : parameters<
22 optional<tag::x,boost::is_convertible<_,int> >
23 , optional<tag::y,boost::is_convertible<_,int> >
24 , optional<tag::z,boost::is_convertible<_,int> >
25 >
26 {};
27
28 #ifdef BOOST_NO_VOID_RETURNS
29 BOOST_PARAMETER_FUN(int, f, 0, 3, f_parameters)
30 #else
31 BOOST_PARAMETER_FUN(void, f, 0, 3, f_parameters)
32 #endif
33 {
34 std::cout << "x = " << p[x | -1] << std::endl;
35 std::cout << "y = " << p[y | -2] << std::endl;
36 std::cout << "z = " << p[z | -3] << std::endl;
37 std::cout << "================" << std::endl;
38 #ifdef BOOST_NO_VOID_RETURNS
39 return 0;
40 #endif
41 }
42
43 }
44
45
46 int main()
47 {
48 using namespace test;
49 f(x = 1, y = 2, z = 3);
50 f(x = 1);
51 f(y = 2);
52 f(z = 3);
53 f(z = 3, x = 1);
54 }
55
56