]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/make_local_shared_array_esft_test.cpp
2 Copyright 2017 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_RVALUE_REFERENCES) && \
10 !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
11 #include <boost/core/lightweight_test.hpp>
12 #include <boost/smart_ptr/enable_shared_from_this.hpp>
13 #include <boost/smart_ptr/make_local_shared.hpp>
16 : public boost::enable_shared_from_this
<type
> {
18 static unsigned instances
;
30 type
& operator=(const type
&);
33 unsigned type::instances
= 0;
37 BOOST_TEST(type::instances
== 0);
39 boost::local_shared_ptr
<type
[]> result
=
40 boost::make_local_shared
<type
[]>(3);
42 result
[0].shared_from_this();
43 BOOST_ERROR("shared_from_this did not throw");
45 BOOST_TEST(type::instances
== 3);
48 BOOST_TEST(type::instances
== 0);
50 boost::local_shared_ptr
<type
[3]> result
=
51 boost::make_local_shared_noinit
<type
[3]>();
53 result
[0].shared_from_this();
54 BOOST_ERROR("shared_from_this did not throw");
56 BOOST_TEST(type::instances
== 3);
59 return boost::report_errors();