diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index 6f77c41..dc24ca2 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -141,7 +141,7 @@ namespace boost { p3 = reinterpret_cast(list); p1 = reinterpret_cast(p2); d2 = get_deleter >(s1); - d2->construct_list(p2, p3, M); + d2->construct_list(p2, p3); return boost::shared_ptr(s1, p1); } template @@ -165,7 +165,7 @@ namespace boost { p3 = reinterpret_cast(list); p1 = reinterpret_cast(p2); d2 = get_deleter >(s1); - d2->construct_list(p2, p3, M); + d2->construct_list(p2, p3); return boost::shared_ptr(s1, p1); } #if defined(BOOST_HAS_RVALUE_REFS) diff --git a/include/boost/smart_ptr/detail/array_deleter.hpp b/include/boost/smart_ptr/detail/array_deleter.hpp index 9fb55e1..8ef0d11 100644 --- a/include/boost/smart_ptr/detail/array_deleter.hpp +++ b/include/boost/smart_ptr/detail/array_deleter.hpp @@ -34,13 +34,13 @@ namespace boost { } #if defined(BOOST_HAS_RVALUE_REFS) void construct(T* memory, T&& value) { - array_construct_value(memory, size, sp_forward(value)); + array_construct(memory, size, sp_forward(value)); object = memory; } #if defined(BOOST_HAS_VARIADIC_TMPL) template void construct(T* memory, Args&&... args) { - array_construct_args(memory, size, sp_forward(args)...); + array_construct(memory, size, sp_forward(args)...); object = memory; } #endif @@ -49,8 +49,9 @@ namespace boost { array_construct_list(memory, size, list); object = memory; } - void construct_list(T* memory, const T* list, std::size_t n) { - array_construct_list(memory, size, list, n); + template + void construct_list(T* memory, const T* list) { + array_construct_list(memory, size, list); object = memory; } void construct_noinit(T* memory) { @@ -84,13 +85,13 @@ namespace boost { } #if defined(BOOST_HAS_RVALUE_REFS) void construct(T* memory, T&& value) { - array_construct_value(memory, N, sp_forward(value)); + array_construct(memory, N, sp_forward(value)); object = memory; } #if defined(BOOST_HAS_VARIADIC_TMPL) template void construct(T* memory, Args&&... args) { - array_construct_args(memory, N, sp_forward(args)...); + array_construct(memory, N, sp_forward(args)...); object = memory; } #endif @@ -99,8 +100,9 @@ namespace boost { array_construct_list(memory, N, list); object = memory; } - void construct_list(T* memory, const T* list, std::size_t n) { - array_construct_list(memory, N, list, n); + template + void construct_list(T* memory, const T* list) { + array_construct_list(memory, N, list); object = memory; } void construct_noinit(T* memory) { diff --git a/include/boost/smart_ptr/detail/array_utility.hpp b/include/boost/smart_ptr/detail/array_utility.hpp index 633be02..b584599 100644 --- a/include/boost/smart_ptr/detail/array_utility.hpp +++ b/include/boost/smart_ptr/detail/array_utility.hpp @@ -17,7 +17,6 @@ namespace boost { namespace detail { template inline void array_destroy(T*, std::size_t, boost::true_type) { - // do nothing } template inline void array_destroy(T* memory, std::size_t size, boost::false_type) { @@ -56,7 +55,7 @@ namespace boost { } #if defined(BOOST_HAS_RVALUE_REFS) template - inline void array_construct_value(T* memory, std::size_t size, T&& value) { + inline void array_construct(T* memory, std::size_t size, T&& value) { std::size_t i = 0; try { for (; i < size; i++) { @@ -70,7 +69,7 @@ namespace boost { } #if defined(BOOST_HAS_VARIADIC_TMPL) template - inline void array_construct_args(T* memory, std::size_t size, Args&&... args) { + inline void array_construct(T* memory, std::size_t size, Args&&... args) { std::size_t i = 0; try { for (; i < size; i++) { @@ -97,13 +96,13 @@ namespace boost { throw; } } - template - inline void array_construct_list(T* memory, std::size_t size, const T* list, std::size_t n) { + template + inline void array_construct_list(T* memory, std::size_t size, const T* list) { std::size_t i = 0; try { for (; i < size; i++) { void* p1 = memory + i; - ::new(p1) T(list[i % n]); + ::new(p1) T(list[i % N]); } } catch (...) { array_destroy(memory, i); @@ -112,7 +111,6 @@ namespace boost { } template inline void array_construct_noinit(T*, std::size_t, boost::true_type) { - // do nothing } template inline void array_construct_noinit(T* memory, std::size_t size, boost::false_type) { diff --git a/include/boost/smart_ptr/make_shared_array.hpp b/include/boost/smart_ptr/make_shared_array.hpp index 8e49b5f..cf63ecb 100644 --- a/include/boost/smart_ptr/make_shared_array.hpp +++ b/include/boost/smart_ptr/make_shared_array.hpp @@ -140,7 +140,7 @@ namespace boost { p3 = reinterpret_cast(list); p1 = reinterpret_cast(p2); d2 = get_deleter >(s1); - d2->construct_list(p2, p3, M); + d2->construct_list(p2, p3); return boost::shared_ptr(s1, p1); } template @@ -163,7 +163,7 @@ namespace boost { p3 = reinterpret_cast(list); p1 = reinterpret_cast(p2); d2 = get_deleter >(s1); - d2->construct_list(p2, p3, M); + d2->construct_list(p2, p3); return boost::shared_ptr(s1, p1); } #if defined(BOOST_HAS_RVALUE_REFS)