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_placeholder_test.cpp - test custom placeholders
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.hpp>
22 
23 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
24 #pragma warning(push, 3)
25 #endif
26 
27 #include <iostream>
28 
29 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
30 #pragma warning(pop)
31 #endif
32 
33 #include <boost/detail/lightweight_test.hpp>
34 
35 //
36 
f(long a,long b,long c,long d,long e,long f,long g,long h,long i)37 long f( long a, long b, long c, long d, long e, long f, long g, long h, long i )
38 {
39     return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
40 }
41 
42 template< int I > struct custom_placeholder
43 {
44 };
45 
46 namespace boost
47 {
48 
49 template< int I > struct is_placeholder< custom_placeholder< I > >
50 {
51     enum { value = I };
52 };
53 
54 } // namespace boost
55 
main()56 int main()
57 {
58     int const x1 = 1;
59     int const x2 = 2;
60     int const x3 = 3;
61     int const x4 = 4;
62     int const x5 = 5;
63     int const x6 = 6;
64     int const x7 = 7;
65     int const x8 = 8;
66     int const x9 = 9;
67 
68     custom_placeholder<1> p1;
69     custom_placeholder<2> p2;
70     custom_placeholder<3> p3;
71     custom_placeholder<4> p4;
72     custom_placeholder<5> p5;
73     custom_placeholder<6> p6;
74     custom_placeholder<7> p7;
75     custom_placeholder<8> p8;
76     custom_placeholder<9> p9;
77 
78     BOOST_TEST(
79         boost::bind( f, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
80         ( x1, x2, x3, x4, x5, x6, x7, x8, x9 ) == 987654321L );
81 
82     return boost::report_errors();
83 }
84