diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index 5fe6cbd..1366aee 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -358,13 +358,6 @@ struct sp_less_align { }; }; -template -BOOST_CONSTEXPR inline std::size_t -sp_objects(std::size_t size) BOOST_NOEXCEPT -{ - return size / sizeof(T); -} - template BOOST_CONSTEXPR inline typename sp_enable::value && @@ -679,9 +672,9 @@ public: type_allocator allocator(allocator_); std::size_t head = sp_align(count); std::size_t tail = sp_align(size_); - std::size_t size = sp_objects(head + tail); + std::size_t size = (head + tail) / sizeof(type); type* address = allocator.allocate(size); - *result_ = address + sp_objects(head); + *result_ = address + head / sizeof(type); return reinterpret_cast(address); } @@ -689,7 +682,7 @@ public: type_allocator allocator(allocator_); std::size_t head = sp_align(count); std::size_t tail = sp_align(size_); - std::size_t size = sp_objects(head + tail); + std::size_t size = (head + tail) / sizeof(type); allocator.deallocate(reinterpret_cast(value), size); }