]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/functional/factory/test/factory_with_none_t.cpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / libs / functional / factory / test / factory_with_none_t.cpp
1 /*=============================================================================
2 Copyright (c) 2007 Tobias Schwinger
3
4 Use modification and distribution are subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
7 ==============================================================================*/
8
9 #include <boost/functional/factory.hpp>
10 #include <boost/core/lightweight_test.hpp>
11 #include <boost/none_t.hpp>
12
13 #include <memory>
14
15 class sum
16 {
17 int val_sum;
18 public:
19 sum(int a, int b) : val_sum(a + b) { }
20
21 operator int() const { return this->val_sum; }
22 };
23
24 // Suppress warnings about std::auto_ptr.
25 #if defined(__clang__)
26 #pragma clang diagnostic push
27 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
28 #endif
29
30 int main()
31 {
32 int one = 1, two = 2;
33 {
34 sum* instance( boost::factory< sum*, boost::none_t >()(one,two) );
35 BOOST_TEST(*instance == 3);
36 }
37 #if !defined(BOOST_NO_AUTO_PTR)
38 {
39 std::auto_ptr<sum> instance(
40 boost::factory< std::auto_ptr<sum>, boost::none_t >()(one,two) );
41 BOOST_TEST(*instance == 3);
42 }
43 #endif
44 #if !defined(BOOST_NO_CXX11_SMART_PTR)
45 {
46 std::unique_ptr<sum> instance(
47 boost::factory< std::unique_ptr<sum>, boost::none_t >()(one,two) );
48 BOOST_TEST(*instance == 3);
49 }
50 #endif
51 return boost::report_errors();
52 }
53
54 #if defined(__clang__)
55 #pragma clang diagnostic pop
56 #endif