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

source code of boost/libs/bind/test/bind_placeholder_test.cpp