]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/make_unique_value_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / smart_ptr / test / make_unique_value_test.cpp
1 /*
2 (c) 2014 Glen Joseph Fernandes
3 <glenjofe -at- gmail.com>
4
5 Distributed under the Boost Software
6 License, Version 1.0.
7 http://boost.org/LICENSE_1_0.txt
8 */
9 #include <boost/config.hpp>
10 #if !defined(BOOST_NO_CXX11_SMART_PTR)
11 #include <boost/detail/lightweight_test.hpp>
12 #include <boost/smart_ptr/make_unique.hpp>
13
14 struct type {
15 int x;
16 int y;
17 };
18
19 int main()
20 {
21 {
22 std::unique_ptr<type> a1 = boost::make_unique<type>();
23 BOOST_TEST(a1.get() != 0);
24 BOOST_TEST(a1->x == 0);
25 BOOST_TEST(a1->y == 0);
26 }
27
28 {
29 std::unique_ptr<const type> a1 = boost::make_unique<const type>();
30 BOOST_TEST(a1.get() != 0);
31 BOOST_TEST(a1->x == 0);
32 BOOST_TEST(a1->y == 0);
33 }
34
35 #if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
36 {
37 std::unique_ptr<type> a1 = boost::make_unique<type>({ 1, 2 });
38 BOOST_TEST(a1.get() != 0);
39 BOOST_TEST(a1->x == 1);
40 BOOST_TEST(a1->y == 2);
41 }
42
43 {
44 std::unique_ptr<const type> a1 = boost::make_unique<const type>({ 1, 2 });
45 BOOST_TEST(a1.get() != 0);
46 BOOST_TEST(a1->x == 1);
47 BOOST_TEST(a1->y == 2);
48 }
49 #endif
50
51 return boost::report_errors();
52 }
53 #else
54
55 int main()
56 {
57 return 0;
58 }
59
60 #endif