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