| 1 | /* |
|---|---|
| 2 | Copyright 2017 Glen Joseph Fernandes |
| 3 | (glenjofe@gmail.com) |
| 4 | |
| 5 | Distributed under the Boost Software License, Version 1.0. |
| 6 | (http://www.boost.org/LICENSE_1_0.txt) |
| 7 | */ |
| 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/make_local_shared.hpp> |
| 13 | |
| 14 | int main() |
| 15 | { |
| 16 | { |
| 17 | boost::local_shared_ptr<int[]> result = |
| 18 | boost::make_local_shared<int[]>(size: 4, value: 1); |
| 19 | BOOST_TEST(result[0] == 1); |
| 20 | BOOST_TEST(result[1] == 1); |
| 21 | BOOST_TEST(result[2] == 1); |
| 22 | BOOST_TEST(result[3] == 1); |
| 23 | } |
| 24 | { |
| 25 | boost::local_shared_ptr<int[4]> result = |
| 26 | boost::make_local_shared<int[4]>(value: 1); |
| 27 | BOOST_TEST(result[0] == 1); |
| 28 | BOOST_TEST(result[1] == 1); |
| 29 | BOOST_TEST(result[2] == 1); |
| 30 | BOOST_TEST(result[3] == 1); |
| 31 | } |
| 32 | { |
| 33 | boost::local_shared_ptr<const int[]> result = |
| 34 | boost::make_local_shared<const int[]>(size: 4, value: 1); |
| 35 | BOOST_TEST(result[0] == 1); |
| 36 | BOOST_TEST(result[1] == 1); |
| 37 | BOOST_TEST(result[2] == 1); |
| 38 | BOOST_TEST(result[3] == 1); |
| 39 | } |
| 40 | { |
| 41 | boost::local_shared_ptr<const int[4]> result = |
| 42 | boost::make_local_shared<const int[4]>(value: 1); |
| 43 | BOOST_TEST(result[0] == 1); |
| 44 | BOOST_TEST(result[1] == 1); |
| 45 | BOOST_TEST(result[2] == 1); |
| 46 | BOOST_TEST(result[3] == 1); |
| 47 | } |
| 48 | return boost::report_errors(); |
| 49 | } |
| 50 | #else |
| 51 | int main() |
| 52 | { |
| 53 | return 0; |
| 54 | } |
| 55 | #endif |
| 56 |
