1 /*==============================================================================
2     Copyright (c) 2006 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/config.hpp>
11 
12 #if defined( BOOST_MSVC )
13 
14 #pragma warning(disable: 4786)  // identifier truncated in debug info
15 #pragma warning(disable: 4710)  // function not inlined
16 #pragma warning(disable: 4711)  // function selected for automatic inline expansion
17 #pragma warning(disable: 4514)  // unreferenced inline removed
18 
19 #endif
20 
21 #include <boost/phoenix/core.hpp>
22 #include <boost/phoenix/bind.hpp>
23 
24 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
25 #pragma warning(push, 3)
26 #endif
27 
28 #include <iostream>
29 
30 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
31 #pragma warning(pop)
32 #endif
33 
34 #include <boost/detail/lightweight_test.hpp>
35 
36 //
37 
f(int x)38 int f( int x )
39 {
40     return x;
41 }
42 
main()43 int main()
44 {
45     using boost::phoenix::bind;
46     using boost::phoenix::placeholders::_1;
47     using boost::phoenix::placeholders::_2;
48     using boost::phoenix::placeholders::_3;
49     using boost::phoenix::placeholders::_4;
50     using boost::phoenix::placeholders::_5;
51     using boost::phoenix::placeholders::_6;
52     using boost::phoenix::placeholders::_7;
53     using boost::phoenix::placeholders::_8;
54     using boost::phoenix::placeholders::_9;
55 
56     BOOST_TEST(
57         bind( f, _1 )
58         ( 1 ) == 1 );
59 
60     BOOST_TEST(
61         bind( f, _2 )
62         ( 1, 2 ) == 2 );
63 
64     BOOST_TEST(
65         bind( f, _3 )
66         ( 1, 2, 3 ) == 3 );
67 
68     BOOST_TEST(
69         bind( f, _4 )
70         ( 1, 2, 3, 4 ) == 4 );
71 
72     BOOST_TEST(
73         bind( f, _5 )
74         ( 1, 2, 3, 4, 5 ) == 5 );
75 
76     BOOST_TEST(
77         bind( f, _6 )
78         ( 1, 2, 3, 4, 5, 6 ) == 6 );
79 
80     BOOST_TEST(
81         bind( f, _7 )
82         ( 1, 2, 3, 4, 5, 6, 7 ) == 7 );
83 
84     BOOST_TEST(
85         bind( f, _8 )
86         ( 1, 2, 3, 4, 5, 6, 7, 8 ) == 8 );
87 
88     BOOST_TEST(
89         bind( f, _9 )
90         ( 1, 2, 3, 4, 5, 6, 7, 8, 9 ) == 9 );
91 
92     return boost::report_errors();
93 }
94