]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/bind/test/bind_function_ap_test.cpp
67551d324781a1967c02dfc4f09e1ddc9c1d7745
1 #include <boost/config.hpp>
4 // bind_function_ap_test.cpp - regression test
6 // Copyright (c) 2015 Peter Dimov
8 // Distributed under the Boost Software License, Version 1.0.
9 // See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt
13 #if defined( BOOST_NO_AUTO_PTR )
21 #if defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 406 )
22 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
23 #elif defined( __clang__ ) && defined( __has_warning )
24 # if __has_warning( "-Wdeprecated-declarations" )
25 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
29 #include <boost/bind.hpp>
30 #include <boost/function.hpp>
31 #include <boost/detail/lightweight_test.hpp>
36 void fv1( std::auto_ptr
<int> p1
)
38 BOOST_TEST( *p1
== 1 );
41 void fv2( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
)
43 BOOST_TEST( *p1
== 1 );
44 BOOST_TEST( *p2
== 2 );
47 void fv3( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
)
49 BOOST_TEST( *p1
== 1 );
50 BOOST_TEST( *p2
== 2 );
51 BOOST_TEST( *p3
== 3 );
54 void fv4( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
)
56 BOOST_TEST( *p1
== 1 );
57 BOOST_TEST( *p2
== 2 );
58 BOOST_TEST( *p3
== 3 );
59 BOOST_TEST( *p4
== 4 );
62 void fv5( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
)
64 BOOST_TEST( *p1
== 1 );
65 BOOST_TEST( *p2
== 2 );
66 BOOST_TEST( *p3
== 3 );
67 BOOST_TEST( *p4
== 4 );
68 BOOST_TEST( *p5
== 5 );
71 void fv6( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
, std::auto_ptr
<int> p6
)
73 BOOST_TEST( *p1
== 1 );
74 BOOST_TEST( *p2
== 2 );
75 BOOST_TEST( *p3
== 3 );
76 BOOST_TEST( *p4
== 4 );
77 BOOST_TEST( *p5
== 5 );
78 BOOST_TEST( *p6
== 6 );
81 void fv7( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
, std::auto_ptr
<int> p6
, std::auto_ptr
<int> p7
)
83 BOOST_TEST( *p1
== 1 );
84 BOOST_TEST( *p2
== 2 );
85 BOOST_TEST( *p3
== 3 );
86 BOOST_TEST( *p4
== 4 );
87 BOOST_TEST( *p5
== 5 );
88 BOOST_TEST( *p6
== 6 );
89 BOOST_TEST( *p7
== 7 );
92 void fv8( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
, std::auto_ptr
<int> p6
, std::auto_ptr
<int> p7
, std::auto_ptr
<int> p8
)
94 BOOST_TEST( *p1
== 1 );
95 BOOST_TEST( *p2
== 2 );
96 BOOST_TEST( *p3
== 3 );
97 BOOST_TEST( *p4
== 4 );
98 BOOST_TEST( *p5
== 5 );
99 BOOST_TEST( *p6
== 6 );
100 BOOST_TEST( *p7
== 7 );
101 BOOST_TEST( *p8
== 8 );
104 void fv9( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
, std::auto_ptr
<int> p6
, std::auto_ptr
<int> p7
, std::auto_ptr
<int> p8
, std::auto_ptr
<int> p9
)
106 BOOST_TEST( *p1
== 1 );
107 BOOST_TEST( *p2
== 2 );
108 BOOST_TEST( *p3
== 3 );
109 BOOST_TEST( *p4
== 4 );
110 BOOST_TEST( *p5
== 5 );
111 BOOST_TEST( *p6
== 6 );
112 BOOST_TEST( *p7
== 7 );
113 BOOST_TEST( *p8
== 8 );
114 BOOST_TEST( *p9
== 9 );
120 boost::function
<void(std::auto_ptr
<int>)> fw1
= boost::bind( fv1
, _1
);
122 std::auto_ptr
<int> p1( new int(1) );
128 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>)> fw2
= boost::bind( fv2
, _1
, _2
);
130 std::auto_ptr
<int> p1( new int(1) );
131 std::auto_ptr
<int> p2( new int(2) );
137 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw3
= boost::bind( fv3
, _1
, _2
, _3
);
139 std::auto_ptr
<int> p1( new int(1) );
140 std::auto_ptr
<int> p2( new int(2) );
141 std::auto_ptr
<int> p3( new int(3) );
147 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw4
= boost::bind( fv4
, _1
, _2
, _3
, _4
);
149 std::auto_ptr
<int> p1( new int(1) );
150 std::auto_ptr
<int> p2( new int(2) );
151 std::auto_ptr
<int> p3( new int(3) );
152 std::auto_ptr
<int> p4( new int(4) );
154 fw4( p1
, p2
, p3
, p4
);
158 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw5
= boost::bind( fv5
, _1
, _2
, _3
, _4
, _5
);
160 std::auto_ptr
<int> p1( new int(1) );
161 std::auto_ptr
<int> p2( new int(2) );
162 std::auto_ptr
<int> p3( new int(3) );
163 std::auto_ptr
<int> p4( new int(4) );
164 std::auto_ptr
<int> p5( new int(5) );
166 fw5( p1
, p2
, p3
, p4
, p5
);
170 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw6
= boost::bind( fv6
, _1
, _2
, _3
, _4
, _5
, _6
);
172 std::auto_ptr
<int> p1( new int(1) );
173 std::auto_ptr
<int> p2( new int(2) );
174 std::auto_ptr
<int> p3( new int(3) );
175 std::auto_ptr
<int> p4( new int(4) );
176 std::auto_ptr
<int> p5( new int(5) );
177 std::auto_ptr
<int> p6( new int(6) );
179 fw6( p1
, p2
, p3
, p4
, p5
, p6
);
183 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw7
= boost::bind( fv7
, _1
, _2
, _3
, _4
, _5
, _6
, _7
);
185 std::auto_ptr
<int> p1( new int(1) );
186 std::auto_ptr
<int> p2( new int(2) );
187 std::auto_ptr
<int> p3( new int(3) );
188 std::auto_ptr
<int> p4( new int(4) );
189 std::auto_ptr
<int> p5( new int(5) );
190 std::auto_ptr
<int> p6( new int(6) );
191 std::auto_ptr
<int> p7( new int(7) );
193 fw7( p1
, p2
, p3
, p4
, p5
, p6
, p7
);
197 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw8
= boost::bind( fv8
, _1
, _2
, _3
, _4
, _5
, _6
, _7
, _8
);
199 std::auto_ptr
<int> p1( new int(1) );
200 std::auto_ptr
<int> p2( new int(2) );
201 std::auto_ptr
<int> p3( new int(3) );
202 std::auto_ptr
<int> p4( new int(4) );
203 std::auto_ptr
<int> p5( new int(5) );
204 std::auto_ptr
<int> p6( new int(6) );
205 std::auto_ptr
<int> p7( new int(7) );
206 std::auto_ptr
<int> p8( new int(8) );
208 fw8( p1
, p2
, p3
, p4
, p5
, p6
, p7
, p8
);
212 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw9
= boost::bind( fv9
, _1
, _2
, _3
, _4
, _5
, _6
, _7
, _8
, _9
);
214 std::auto_ptr
<int> p1( new int(1) );
215 std::auto_ptr
<int> p2( new int(2) );
216 std::auto_ptr
<int> p3( new int(3) );
217 std::auto_ptr
<int> p4( new int(4) );
218 std::auto_ptr
<int> p5( new int(5) );
219 std::auto_ptr
<int> p6( new int(6) );
220 std::auto_ptr
<int> p7( new int(7) );
221 std::auto_ptr
<int> p8( new int(8) );
222 std::auto_ptr
<int> p9( new int(9) );
224 fw9( p1
, p2
, p3
, p4
, p5
, p6
, p7
, p8
, p9
);
231 return boost::report_errors();
234 #endif // #if defined( BOOST_NO_AUTO_PTR )