1 /*==============================================================================
2     Copyright (c) 2009 Peter Dimov
3     Copyright (c) 2005-2010 Joel de Guzman
4     Copyright (c) 2010 Thomas Heller
5 
6     Distributed under the Boost Software License, Version 1.0. (See accompanying
7     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 ==============================================================================*/
9 
10 #include <boost/phoenix/core.hpp>
11 #include <boost/phoenix/bind.hpp>
12 #include <boost/ref.hpp>
13 #include <boost/detail/lightweight_test.hpp>
14 
15 struct X
16 {
fX17     int f( int x )
18     {
19         return x;
20     }
21 
gX22     int g( int x ) const
23     {
24         return -x;
25     }
26 };
27 
main()28 int main()
29 {
30     using boost::phoenix::bind;
31     using boost::phoenix::placeholders::_1;
32     X x;
33 
34     BOOST_TEST( bind( &X::f, _1, 1 )( boost::ref( x ) ) == 1 );
35     BOOST_TEST( bind( &X::g, _1, 2 )( boost::cref( x ) ) == -2 );
36 
37     return boost::report_errors();
38 }
39