]>
git.proxmox.com Git - ceph.git/blob - 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)
6 #include <boost/parameter.hpp>
7 #include <boost/type_traits/is_convertible.hpp>
8 #include <boost/mpl/placeholders.hpp>
13 BOOST_PARAMETER_KEYWORD(tag
, x
)
14 BOOST_PARAMETER_KEYWORD(tag
, y
)
15 BOOST_PARAMETER_KEYWORD(tag
, z
)
17 using namespace boost::parameter
;
18 using namespace boost::mpl::placeholders
;
20 struct f_parameters
// vc6 is happier with inheritance than with a typedef
22 optional
<tag::x
,boost::is_convertible
<_
,int> >
23 , optional
<tag::y
,boost::is_convertible
<_
,int> >
24 , optional
<tag::z
,boost::is_convertible
<_
,int> >
28 #ifdef BOOST_NO_VOID_RETURNS
29 BOOST_PARAMETER_FUN(int, f
, 0, 3, f_parameters
)
31 BOOST_PARAMETER_FUN(void, f
, 0, 3, f_parameters
)
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
49 f(x
= 1, y
= 2, z
= 3);