]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/bind/test/std_placeholders_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / bind / test / std_placeholders_test.cpp
1 // Copyright 2021 Peter Dimov
2 // Distributed under the Boost Software License, Version 1.0.
3 // https://www.boost.org/LICENSE_1_0.txt
4
5 #include <boost/bind/bind.hpp>
6 #include <boost/core/lightweight_test.hpp>
7 #include <functional>
8 #include <boost/config.hpp>
9 #include <boost/config/pragma_message.hpp>
10
11 #if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
12
13 BOOST_PRAGMA_MESSAGE( "Skipping test due to BOOST_NO_CXX11_HDR_FUNCTIONAL being defined" )
14 int main() {}
15
16 #elif defined(BOOST_NO_CXX11_DECLTYPE)
17
18 BOOST_PRAGMA_MESSAGE( "Skipping test due to BOOST_NO_CXX11_DECLTYPE being defined" )
19 int main() {}
20
21 #elif defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
22
23 BOOST_PRAGMA_MESSAGE( "Skipping test due to BOOST_NO_CXX11_HDR_TYPE_TRAITS being defined" )
24 int main() {}
25
26 #else
27
28 int f( int x )
29 {
30 return -x;
31 }
32
33 int main()
34 {
35 using namespace std::placeholders;
36
37 BOOST_TEST_EQ( boost::bind( f, _1 )( 1 ), -1 );
38 BOOST_TEST_EQ( boost::bind( f, _2 )( 1, 2 ), -2 );
39 BOOST_TEST_EQ( boost::bind( f, _3 )( 1, 2, 3 ), -3 );
40 BOOST_TEST_EQ( boost::bind( f, _4 )( 1, 2, 3, 4 ), -4 );
41 BOOST_TEST_EQ( boost::bind( f, _5 )( 1, 2, 3, 4, 5 ), -5 );
42 BOOST_TEST_EQ( boost::bind( f, _6 )( 1, 2, 3, 4, 5, 6 ), -6 );
43 BOOST_TEST_EQ( boost::bind( f, _7 )( 1, 2, 3, 4, 5, 6, 7 ), -7 );
44 BOOST_TEST_EQ( boost::bind( f, _8 )( 1, 2, 3, 4, 5, 6, 7, 8 ), -8 );
45 BOOST_TEST_EQ( boost::bind( f, _9 )( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), -9 );
46
47 return boost::report_errors();
48 }
49
50 #endif