]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/bind/bind_member_function_tests.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
9 #include <boost/detail/lightweight_test.hpp>
10 #include <boost/noncopyable.hpp>
11 #include <boost/phoenix/core.hpp>
12 #include <boost/phoenix/operator.hpp>
13 #include <boost/phoenix/bind.hpp>
17 struct x
//: boost::noncopyable // test non-copyable (hold this by reference)
22 std::cout
<< "Test binding member functions...\n";
26 struct y
//: boost::noncopyable // test non-copyable (hold this by reference)
35 struct z
//: boost::noncopyable // test non-copyable (hold this by reference)
38 plus(int a
, int b
) const
44 struct zz
//: boost::noncopyable // test non-copyable (hold this by reference)
47 plus3(int a
, int b
, int c
) const
57 using boost::phoenix::bind
;
58 using boost::phoenix::ref
;
59 using boost::phoenix::arg_names::arg1
;
60 using boost::phoenix::arg_names::arg2
;
61 using boost::phoenix::arg_names::arg3
;
70 bind(&test::x::test
, x_
)();
71 BOOST_TEST(bind(&test::y::negate
, y_
, arg1
)(a
) == -a
);
72 BOOST_TEST(bind(&test::z::plus
, arg1
, arg2
, arg3
)(z_
, a
, b
) == a
+b
);
73 BOOST_TEST(bind(&test::zz::plus3
, zz_
, arg1
, arg2
, arg3
)(a
, b
, a
) == a
+b
+a
);
74 BOOST_TEST(bind(&test::y::negate
, &y_
, 777)(a
) == -777);
76 return boost::report_errors();