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/make_shared_array.hpp> 11 main()12int main() { 13 { 14 boost::shared_ptr<int[]> a1 = boost::make_shared<int[]>(4, 1); 15 BOOST_TEST(a1[0] == 1); 16 BOOST_TEST(a1[1] == 1); 17 BOOST_TEST(a1[2] == 1); 18 BOOST_TEST(a1[3] == 1); 19 } 20 21 { 22 boost::shared_ptr<int[4]> a1 = boost::make_shared<int[4]>(1); 23 BOOST_TEST(a1[0] == 1); 24 BOOST_TEST(a1[1] == 1); 25 BOOST_TEST(a1[2] == 1); 26 BOOST_TEST(a1[3] == 1); 27 } 28 29 { 30 boost::shared_ptr<const int[]> a1 = boost::make_shared<const int[]>(4, 1); 31 BOOST_TEST(a1[0] == 1); 32 BOOST_TEST(a1[1] == 1); 33 BOOST_TEST(a1[2] == 1); 34 BOOST_TEST(a1[3] == 1); 35 } 36 37 { 38 boost::shared_ptr<const int[4]> a1 = boost::make_shared<const int[4]>(1); 39 BOOST_TEST(a1[0] == 1); 40 BOOST_TEST(a1[1] == 1); 41 BOOST_TEST(a1[2] == 1); 42 BOOST_TEST(a1[3] == 1); 43 } 44 45 return boost::report_errors(); 46 } 47