]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/make_shared_array_esft_test.cpp
2 Copyright 2012-2015 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/core/lightweight_test.hpp>
9 #include <boost/smart_ptr/enable_shared_from_this.hpp>
10 #include <boost/smart_ptr/make_shared.hpp>
13 : public boost::enable_shared_from_this
<type
> {
15 static unsigned instances
;
27 type
& operator=(const type
&);
30 unsigned type::instances
= 0;
34 BOOST_TEST(type::instances
== 0);
36 boost::shared_ptr
<type
[]> result
=
37 boost::make_shared
<type
[]>(3);
39 result
[0].shared_from_this();
40 BOOST_ERROR("shared_from_this did not throw");
42 BOOST_TEST(type::instances
== 3);
45 BOOST_TEST(type::instances
== 0);
47 boost::shared_ptr
<type
[3]> result
=
48 boost::make_shared_noinit
<type
[3]>();
50 result
[0].shared_from_this();
51 BOOST_ERROR("shared_from_this did not throw");
53 BOOST_TEST(type::instances
== 3);
56 return boost::report_errors();