From d512eaaa0f631ef7d08dc7e10af6a640712c92d2 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Fri, 9 Nov 2012 10:14:55 +0000 Subject: [PATCH] Change make_shared and allocate_shared array form semantics with initializer lists overload that takes no size. [SVN r81259] --- include/boost/smart_ptr/allocate_shared_array.hpp | 4 ++-- include/boost/smart_ptr/make_shared_array.hpp | 4 ++-- test/allocate_shared_array_create_test.cpp | 4 ++-- test/make_shared_array_create_test.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index d860d05..8a70098 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -55,14 +55,14 @@ namespace boost { #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) template inline typename detail::sp_if_array::type - allocate_shared(const A& allocator, size_t size, typename detail::array_list::type list) { + allocate_shared(const A& allocator, typename detail::array_list::type list) { typedef typename shared_ptr::element_type T1; typedef typename detail::array_type::type T2; typedef const T2 T3; T1* p1 = 0; T2* p2 = 0; T3* p3 = 0; - size_t n1 = size * detail::array_size::size; + size_t n1 = list.size() * detail::array_size::size; detail::allocate_array_helper a1(allocator, n1, &p2); detail::array_deleter d1; shared_ptr s1(p1, d1, a1); diff --git a/include/boost/smart_ptr/make_shared_array.hpp b/include/boost/smart_ptr/make_shared_array.hpp index 343ecfd..9c30e94 100644 --- a/include/boost/smart_ptr/make_shared_array.hpp +++ b/include/boost/smart_ptr/make_shared_array.hpp @@ -55,14 +55,14 @@ namespace boost { #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) template inline typename detail::sp_if_array::type - make_shared(std::size_t size, typename detail::array_list::type list) { + make_shared(typename detail::array_list::type list) { typedef typename shared_ptr::element_type T1; typedef typename detail::array_type::type T2; typedef const T2 T3; T1* p1 = 0; T2* p2 = 0; T3* p3 = 0; - size_t n1 = size * detail::array_size::size; + size_t n1 = list.size() * detail::array_size::size; detail::make_array_helper a1(n1, &p2); detail::array_deleter d1; shared_ptr s1(p1, d1, a1); diff --git a/test/allocate_shared_array_create_test.cpp b/test/allocate_shared_array_create_test.cpp index 5c3f831..3df1e82 100644 --- a/test/allocate_shared_array_create_test.cpp +++ b/test/allocate_shared_array_create_test.cpp @@ -76,14 +76,14 @@ int main() { #endif #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator(), 4, { 0, 1, 2, 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(), 2, { {0, 1}, {2, 3} }); + boost::shared_ptr a1 = boost::allocate_shared(std::allocator(), { {0, 1}, {2, 3} }); BOOST_TEST(a1[0][0] == 0); BOOST_TEST(a1[0][1] == 1); BOOST_TEST(a1[1][0] == 2); diff --git a/test/make_shared_array_create_test.cpp b/test/make_shared_array_create_test.cpp index 7510585..b89d95f 100644 --- a/test/make_shared_array_create_test.cpp +++ b/test/make_shared_array_create_test.cpp @@ -76,14 +76,14 @@ int main() { #endif #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) { - boost::shared_ptr a1 = boost::make_shared(4, { 0, 1, 2, 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(2, { {0, 1}, {2, 3} }); + boost::shared_ptr a1 = boost::make_shared({ {0, 1}, {2, 3} }); BOOST_TEST(a1[0][0] == 0); BOOST_TEST(a1[0][1] == 1); BOOST_TEST(a1[1][0] == 2);