]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/allocate_shared_arrays_test.cpp
2 (c) 2012-2015 Glen Joseph Fernandes
3 <glenjofe -at- gmail.com>
5 Distributed under the Boost Software
7 http://boost.org/LICENSE_1_0.txt
9 #include <boost/core/lightweight_test.hpp>
10 #include <boost/smart_ptr/make_shared.hpp>
14 #if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
16 boost::shared_ptr
<int[][2]> a1
= boost::allocate_shared
<int[][2]>(std::allocator
<int>(), 2, {0, 1});
17 BOOST_TEST(a1
[0][0] == 0);
18 BOOST_TEST(a1
[0][1] == 1);
19 BOOST_TEST(a1
[1][0] == 0);
20 BOOST_TEST(a1
[1][1] == 1);
23 boost::shared_ptr
<int[2][2]> a1
= boost::allocate_shared
<int[2][2]>(std::allocator
<int>(), { 0, 1 });
24 BOOST_TEST(a1
[0][0] == 0);
25 BOOST_TEST(a1
[0][1] == 1);
26 BOOST_TEST(a1
[1][0] == 0);
27 BOOST_TEST(a1
[1][1] == 1);
30 boost::shared_ptr
<const int[][2]> a1
= boost::allocate_shared
<const int[][2]>(std::allocator
<int>(), 2, { 0, 1 });
31 BOOST_TEST(a1
[0][0] == 0);
32 BOOST_TEST(a1
[0][1] == 1);
33 BOOST_TEST(a1
[1][0] == 0);
34 BOOST_TEST(a1
[1][1] == 1);
37 boost::shared_ptr
<const int[2][2]> a1
= boost::allocate_shared
<const int[2][2]>(std::allocator
<int>(), { 0, 1 });
38 BOOST_TEST(a1
[0][0] == 0);
39 BOOST_TEST(a1
[0][1] == 1);
40 BOOST_TEST(a1
[1][0] == 0);
41 BOOST_TEST(a1
[1][1] == 1);
44 return boost::report_errors();