• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <boost/config.hpp>
2 
3 #if defined( BOOST_MSVC )
4 
5 #pragma warning(disable: 4786)  // identifier truncated in debug info
6 #pragma warning(disable: 4710)  // function not inlined
7 #pragma warning(disable: 4711)  // function selected for automatic inline expansion
8 #pragma warning(disable: 4514)  // unreferenced inline removed
9 
10 #endif
11 
12 //  bind_rvalue_test.cpp
13 //
14 //  Copyright (c) 2006 Peter Dimov
15 //
16 // Distributed under the Boost Software License, Version 1.0.
17 //
18 // See accompanying file LICENSE_1_0.txt or copy at
19 // http://www.boost.org/LICENSE_1_0.txt)
20 
21 #include <boost/bind/bind.hpp>
22 #include <boost/core/lightweight_test.hpp>
23 
24 using namespace boost::placeholders;
25 
26 //
27 
f(int x)28 int f( int x )
29 {
30     return x;
31 }
32 
main()33 int main()
34 {
35     BOOST_TEST(
36         boost::bind( f, _1 )
37         ( 1 ) == 1 );
38 
39     BOOST_TEST(
40         boost::bind( f, _2 )
41         ( 1, 2 ) == 2 );
42 
43     BOOST_TEST(
44         boost::bind( f, _3 )
45         ( 1, 2, 3 ) == 3 );
46 
47     BOOST_TEST(
48         boost::bind( f, _4 )
49         ( 1, 2, 3, 4 ) == 4 );
50 
51     BOOST_TEST(
52         boost::bind( f, _5 )
53         ( 1, 2, 3, 4, 5 ) == 5 );
54 
55     BOOST_TEST(
56         boost::bind( f, _6 )
57         ( 1, 2, 3, 4, 5, 6 ) == 6 );
58 
59     BOOST_TEST(
60         boost::bind( f, _7 )
61         ( 1, 2, 3, 4, 5, 6, 7 ) == 7 );
62 
63     BOOST_TEST(
64         boost::bind( f, _8 )
65         ( 1, 2, 3, 4, 5, 6, 7, 8 ) == 8 );
66 
67     BOOST_TEST(
68         boost::bind( f, _9 )
69         ( 1, 2, 3, 4, 5, 6, 7, 8, 9 ) == 9 );
70 
71     return boost::report_errors();
72 }
73