]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/make_unique_test.cpp
2 Copyright 2014 Glen Joseph Fernandes
5 Distributed under the Boost Software License, Version 1.0.
6 (http://www.boost.org/LICENSE_1_0.txt)
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>
15 static unsigned instances
;
27 type
& operator=(const type
&);
30 unsigned type::instances
= 0;
35 std::unique_ptr
<int> result
= boost::make_unique
<int>();
36 BOOST_TEST(result
.get() != 0);
37 BOOST_TEST(*result
== 0);
40 std::unique_ptr
<const int> result
=
41 boost::make_unique
<const int>();
42 BOOST_TEST(result
.get() != 0);
43 BOOST_TEST(*result
== 0);
45 BOOST_TEST(type::instances
== 0);
47 std::unique_ptr
<type
> result
=
48 boost::make_unique
<type
>();
49 BOOST_TEST(result
.get() != 0);
50 BOOST_TEST(type::instances
== 1);
52 BOOST_TEST(type::instances
== 0);
54 BOOST_TEST(type::instances
== 0);
56 std::unique_ptr
<const type
> result
=
57 boost::make_unique
<const type
>();
58 BOOST_TEST(result
.get() != 0);
59 BOOST_TEST(type::instances
== 1);
61 BOOST_TEST(type::instances
== 0);
63 return boost::report_errors();