1 /*
2 * Copyright (c) 2012-2014 Glen Joseph Fernandes
3 * glenfe at live dot com
4 *
5 * Distributed under the Boost Software License,
6 * Version 1.0. (See accompanying file LICENSE_1_0.txt
7 * or copy at http://boost.org/LICENSE_1_0.txt)
8 */
9 #include <boost/detail/lightweight_test.hpp>
10 #include <boost/smart_ptr/allocate_shared_array.hpp>
11
main()12 int main() {
13 #if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
14 {
15 boost::shared_ptr<int[][2]> a1 = boost::allocate_shared<int[][2]>(std::allocator<int>(), 2, {0, 1});
16 BOOST_TEST(a1[0][0] == 0);
17 BOOST_TEST(a1[0][1] == 1);
18 BOOST_TEST(a1[1][0] == 0);
19 BOOST_TEST(a1[1][1] == 1);
20 }
21
22 {
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);
28 }
29
30 {
31 boost::shared_ptr<const int[][2]> a1 = boost::allocate_shared<const int[][2]>(std::allocator<int>(), 2, { 0, 1 });
32 BOOST_TEST(a1[0][0] == 0);
33 BOOST_TEST(a1[0][1] == 1);
34 BOOST_TEST(a1[1][0] == 0);
35 BOOST_TEST(a1[1][1] == 1);
36 }
37
38 {
39 boost::shared_ptr<const int[2][2]> a1 = boost::allocate_shared<const int[2][2]>(std::allocator<int>(), { 0, 1 });
40 BOOST_TEST(a1[0][0] == 0);
41 BOOST_TEST(a1[0][1] == 1);
42 BOOST_TEST(a1[1][0] == 0);
43 BOOST_TEST(a1[1][1] == 1);
44 }
45 #endif
46
47 return boost::report_errors();
48 }
49