1/*==============================================================================
2 Copyright (c) 2005 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
38long f( long a, long b, long c, long d, long e, long f, long g, long h, long i )
39{
40 return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
41}
42
43template< int I > struct custom_placeholder
44 : boost::mpl::int_<I>
45{
46};
47
48namespace boost
49{
50
51template< int I > struct is_placeholder< custom_placeholder< I > >
52{
53 enum { value = I + 1};
54};
55
56} // namespace boost
57
58int main()
59{
60 using boost::phoenix::bind;
61
62 int const x1 = 1;
63 int const x2 = 2;
64 int const x3 = 3;
65 int const x4 = 4;
66 int const x5 = 5;
67 int const x6 = 6;
68 int const x7 = 7;
69 int const x8 = 8;
70 int const x9 = 9;
71
72 custom_placeholder<0> p1;
73 custom_placeholder<1> p2;
74 custom_placeholder<2> p3;
75 custom_placeholder<3> p4;
76 custom_placeholder<4> p5;
77 custom_placeholder<5> p6;
78 custom_placeholder<6> p7;
79 custom_placeholder<7> p8;
80 custom_placeholder<8> p9;
81
82 BOOST_TEST(
83 bind( f, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
84 ( x1, x2, x3, x4, x5, x6, x7, x8, x9 ) == 987654321L );
85
86 return boost::report_errors();
87}
88

source code of boost/libs/phoenix/test/boost_bind_compatibility/bind_placeholder_test.cpp