]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/boost_bind_compatibility/bind_cv_test.cpp
1 /*==============================================================================
2 Copyright (c) 2004 Peter Dimov
3 Copyright (c) 2005-2010 Joel de Guzman
4 Copyright (c) 2010 Thomas Heller
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 ==============================================================================*/
10 #include <boost/config.hpp>
12 #if defined(BOOST_MSVC)
13 #pragma warning(disable: 4786) // identifier truncated in debug info
14 #pragma warning(disable: 4710) // function not inlined
15 #pragma warning(disable: 4711) // function selected for automatic inline expansion
16 #pragma warning(disable: 4514) // unreferenced inline removed
19 #include <boost/phoenix/core.hpp>
20 #include <boost/phoenix/bind.hpp>
22 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
23 #pragma warning(push, 3)
28 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
32 #include <boost/detail/lightweight_test.hpp>
36 typedef int result_type
;
43 int operator()() const
48 int operator()(int x1
)
53 int operator()(int x1
) const
58 int operator()(int x1
, int x2
)
63 int operator()(int x1
, int x2
) const
68 int operator()(int x1
, int x2
, int x3
)
73 int operator()(int x1
, int x2
, int x3
) const
78 int operator()(int x1
, int x2
, int x3
, int x4
)
83 int operator()(int x1
, int x2
, int x3
, int x4
) const
85 return -(x1
+x2
+x3
+x4
);
88 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
)
90 return x1
+x2
+x3
+x4
+x5
;
93 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
) const
95 return -(x1
+x2
+x3
+x4
+x5
);
98 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
, int x6
)
100 return x1
+x2
+x3
+x4
+x5
+x6
;
103 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
, int x6
) const
105 return -(x1
+x2
+x3
+x4
+x5
+x6
);
108 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
, int x6
, int x7
)
110 return x1
+x2
+x3
+x4
+x5
+x6
+x7
;
113 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
, int x6
, int x7
) const
115 return -(x1
+x2
+x3
+x4
+x5
+x6
+x7
);
118 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
, int x6
, int x7
, int x8
)
120 return x1
+x2
+x3
+x4
+x5
+x6
+x7
+x8
;
123 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
, int x6
, int x7
, int x8
) const
125 return -(x1
+x2
+x3
+x4
+x5
+x6
+x7
+x8
);
128 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
, int x6
, int x7
, int x8
, int x9
)
130 return x1
+x2
+x3
+x4
+x5
+x6
+x7
+x8
+x9
;
133 int operator()(int x1
, int x2
, int x3
, int x4
, int x5
, int x6
, int x7
, int x8
, int x9
) const
135 return -(x1
+x2
+x3
+x4
+x5
+x6
+x7
+x8
+x9
);
139 template<class F
> void test(F f
, int r
)
142 BOOST_TEST( cf() == -r
);
143 BOOST_TEST( f() == r
);
149 using boost::phoenix::bind
;
150 using boost::phoenix::ref
;
151 using boost::phoenix::cref
;
153 test( bind(X()), 17041);
154 test( bind(X(), 1), 1);
155 test( bind(X(), 1, 2), 1+2);
156 test( bind(X(), 1, 2, 3), 1+2+3);
157 test( bind(X(), 1, 2, 3, 4), 1+2+3+4);
158 test( bind(X(), 1, 2, 3, 4, 5), 1+2+3+4+5);
159 test( bind(X(), 1, 2, 3, 4, 5, 6), 1+2+3+4+5+6);
160 test( bind(X(), 1, 2, 3, 4, 5, 6, 7), 1+2+3+4+5+6+7);
161 test( bind(X(), 1, 2, 3, 4, 5, 6, 7, 8), 1+2+3+4+5+6+7+8);
162 test( bind(X(), 1, 2, 3, 4, 5, 6, 7, 8, 9), 1+2+3+4+5+6+7+8+9);
164 return boost::report_errors();