From 4da0e2b7fc942b11c256f00c1908e8feb5d81027 Mon Sep 17 00:00:00 2001
From: Glen Fernandes
template<typename T, typename... Args> - shared_ptr<T[N]> make_shared(initializer_list<T> list); + shared_ptr<T[N]> make_shared(const T (&list)[N]); template<typename T, typename A, typename... Args> - shared_ptr<T[N]> allocate_shared(const A& allocator, initializer_list<T> list);+ shared_ptr<T[N]> allocate_shared(const A& allocator, const T (&list)[N]);
Description: These overloads of the utilities above are for a fixed size array.
@@ -157,9 +157,9 @@ template<typename T, typename A, typename... Args> from the initializer list.
template<typename T, typename... Args> - shared_ptr<T[M][N]> make_shared(initializer_list<T> list); + shared_ptr<T[M][N]> make_shared(const T (&list)[N]); template<typename T, typename A, typename... Args> - shared_ptr<T[M][N]> allocate_shared(const A& allocator, initializer_list<T> list);+ shared_ptr<T[M][N]> allocate_shared(const A& allocator, const T (&list)[N]);
Description: These overloads of the utilities above are for a fixed size array.
diff --git a/test/allocate_shared_arrays_create_test.cpp b/test/allocate_shared_arrays_create_test.cpp index 03a2d7e..7764edf 100644 --- a/test/allocate_shared_arrays_create_test.cpp +++ b/test/allocate_shared_arrays_create_test.cpp @@ -11,6 +11,20 @@ int main() { #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + { + boost::shared_ptra1 = boost::allocate_shared (std::allocator (), {0, 1, 2, 3}); + BOOST_TEST(a1[0] == 0); + BOOST_TEST(a1[1] == 1); + BOOST_TEST(a1[2] == 2); + BOOST_TEST(a1[3] == 3); + } + { + boost::shared_ptr a1 = boost::allocate_shared (std::allocator (), {0, 1, 2, 3}); + BOOST_TEST(a1[0] == 0); + BOOST_TEST(a1[1] == 1); + BOOST_TEST(a1[2] == 2); + BOOST_TEST(a1[3] == 3); + } { boost::shared_ptr a1 = boost::allocate_shared (std::allocator (), { {0, 1}, {2, 3} }); BOOST_TEST(a1[0][0] == 0); diff --git a/test/make_shared_arrays_create_test.cpp b/test/make_shared_arrays_create_test.cpp index e468378..e999182 100644 --- a/test/make_shared_arrays_create_test.cpp +++ b/test/make_shared_arrays_create_test.cpp @@ -12,6 +12,20 @@ int main() { #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + { + boost::shared_ptr a1 = boost::make_shared ({0, 1, 2, 3}); + BOOST_TEST(a1[0] == 0); + BOOST_TEST(a1[1] == 1); + BOOST_TEST(a1[2] == 2); + BOOST_TEST(a1[3] == 3); + } + { + boost::shared_ptr a1 = boost::make_shared ({0, 1, 2, 3}); + BOOST_TEST(a1[0] == 0); + BOOST_TEST(a1[1] == 1); + BOOST_TEST(a1[2] == 2); + BOOST_TEST(a1[3] == 3); + } { boost::shared_ptr a1 = boost::make_shared ({ {0, 1}, {2, 3} }); BOOST_TEST(a1[0][0] == 0);