diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index c063a35..6dca68f 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -111,8 +111,7 @@ struct sp_array_count { }; template inline D* -sp_get_deleter(const - boost::shared_ptr& value) BOOST_NOEXCEPT_OR_NOTHROW +sp_get_deleter(const boost::shared_ptr& value) BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(value._internal_get_untyped_deleter()); } @@ -135,8 +134,7 @@ struct sp_max_size { #if !defined(BOOST_NO_CXX11_ALLOCATOR) template struct sp_bind_allocator { - typedef typename std::allocator_traits::template - rebind_alloc type; + typedef typename std::allocator_traits::template rebind_alloc type; }; #else template @@ -154,13 +152,11 @@ struct sp_enable { }; template -inline -typename sp_enable::value>::type +inline typename sp_enable::value>::type sp_array_destroy(T*, std::size_t) BOOST_NOEXCEPT { } template -inline -typename sp_enable::value>::type +inline typename sp_enable::value>::type sp_array_destroy(T* storage, std::size_t size) { while (size > 0) { @@ -181,8 +177,7 @@ sp_array_destroy(A& allocator, T* storage, std::size_t size) #if !defined(BOOST_NO_EXCEPTIONS) template -inline -typename sp_enable::value || +inline typename sp_enable::value || boost::has_trivial_destructor::value>::type sp_array_construct(T* storage, std::size_t size) { @@ -192,8 +187,7 @@ sp_array_construct(T* storage, std::size_t size) } template -inline -typename sp_enable::value && +inline typename sp_enable::value && !boost::has_trivial_destructor::value>::type sp_array_construct(T* storage, std::size_t size) { @@ -209,8 +203,7 @@ sp_array_construct(T* storage, std::size_t size) } template -inline -typename sp_enable::value || +inline typename sp_enable::value || boost::has_trivial_destructor::value>::type sp_array_construct(T* storage, std::size_t size, const T* list, std::size_t count) @@ -221,8 +214,7 @@ sp_array_construct(T* storage, std::size_t size, const T* list, } template -inline -typename sp_enable::value && +inline typename sp_enable::value && !boost::has_trivial_destructor::value>::type sp_array_construct(T* storage, std::size_t size, const T* list, std::size_t count) @@ -315,14 +307,12 @@ sp_array_construct(A& allocator, T* storage, std::size_t size, #endif template -inline -typename sp_enable::value>::type +inline typename sp_enable::value>::type sp_array_default(T*, std::size_t) BOOST_NOEXCEPT { } #if !defined(BOOST_NO_EXCEPTIONS) template -inline -typename sp_enable::value && +inline typename sp_enable::value && boost::has_trivial_destructor::value>::type sp_array_default(T* storage, std::size_t size) { @@ -332,8 +322,7 @@ sp_array_default(T* storage, std::size_t size) } template -inline -typename sp_enable::value && +inline typename sp_enable::value && !boost::has_trivial_destructor::value>::type sp_array_default(T* storage, std::size_t size) { @@ -349,8 +338,7 @@ sp_array_default(T* storage, std::size_t size) } #else template -inline -typename sp_enable::value>::type +inline typename sp_enable::value>::type sp_array_default(T* storage, std::size_t size) { for (std::size_t i = 0; i < size; ++i) { @@ -367,16 +355,16 @@ struct sp_less_align { }; template -BOOST_CONSTEXPR inline -typename sp_enable::value, std::size_t>::type +BOOST_CONSTEXPR +inline typename sp_enable::value, std::size_t>::type sp_align(std::size_t size) BOOST_NOEXCEPT { return (sizeof(T) * size + N - 1) & ~(N - 1); } template -BOOST_CONSTEXPR inline -typename sp_enable::value, std::size_t>::type +BOOST_CONSTEXPR +inline typename sp_enable::value, std::size_t>::type sp_align(std::size_t size) BOOST_NOEXCEPT { return sizeof(T) * size; @@ -426,8 +414,7 @@ public: } void* construct(const T* list, std::size_t count) { - sp_array_construct(reinterpret_cast(&storage_), N, - list, count); + sp_array_construct(reinterpret_cast(&storage_), N, list, count); enabled_ = true; return &storage_; } @@ -463,30 +450,27 @@ public: ~sp_size_array_destroyer() { if (enabled_) { - sp_array_destroy(allocator_, - reinterpret_cast(&storage_), N); + sp_array_destroy(allocator_, reinterpret_cast(&storage_), N); } } template void operator()(U) { if (enabled_) { - sp_array_destroy(allocator_, - reinterpret_cast(&storage_), N); + sp_array_destroy(allocator_, reinterpret_cast(&storage_), N); enabled_ = false; } } void* construct() { - sp_array_construct(allocator_, - reinterpret_cast(&storage_), N); + sp_array_construct(allocator_, reinterpret_cast(&storage_), N); enabled_ = true; return &storage_; } void* construct(const T* list, std::size_t count) { - sp_array_construct(allocator_, - reinterpret_cast(&storage_), N, list, count); + sp_array_construct(allocator_, reinterpret_cast(&storage_), N, + list, count); enabled_ = true; return &storage_; } @@ -573,8 +557,7 @@ public: static void operator_fn(U) BOOST_NOEXCEPT { } template - sp_array_destroyer(const U& allocator, std::size_t size) - BOOST_NOEXCEPT + sp_array_destroyer(const U& allocator, std::size_t size) BOOST_NOEXCEPT : allocator_(allocator), size_(size), address_(0) { } @@ -592,16 +575,14 @@ public: ~sp_array_destroyer() { if (address_) { - sp_array_destroy(allocator_, static_cast(address_), - size_); + sp_array_destroy(allocator_, static_cast(address_), size_); } } template void operator()(U) { if (address_) { - sp_array_destroy(allocator_, static_cast(address_), - size_); + sp_array_destroy(allocator_, static_cast(address_), size_); address_ = 0; } } @@ -655,20 +636,18 @@ public: typename sp_bind_allocator::type> other; }; - sp_array_allocator(const A& allocator, std::size_t size, - void** result) BOOST_NOEXCEPT + sp_array_allocator(const A& allocator, std::size_t size, void** result) + BOOST_NOEXCEPT : allocator_(allocator), size_(size), result_(result) { } - sp_array_allocator(const A& allocator, std::size_t size) - BOOST_NOEXCEPT + sp_array_allocator(const A& allocator, std::size_t size) BOOST_NOEXCEPT : allocator_(allocator), size_(size) { } template - sp_array_allocator(const sp_array_allocator& other) - BOOST_NOEXCEPT + sp_array_allocator(const sp_array_allocator& other) BOOST_NOEXCEPT : allocator_(other.allocator_), size_(other.size_), result_(other.result_) { } @@ -956,8 +935,8 @@ allocate_shared(const A& allocator, shared_ptr result(static_cast(0), detail::sp_inplace_tag(), allocator); deleter* state = detail::sp_get_deleter(result); - void* start = state->construct(reinterpret_cast(&value), detail::sp_array_count::value); + void* start = state->construct(reinterpret_cast(&value), + detail::sp_array_count::value); return shared_ptr(result, static_cast(start)); } diff --git a/test/allocate_shared_array_noinit_test.cpp b/test/allocate_shared_array_noinit_test.cpp index f30ee17..644acd2 100644 --- a/test/allocate_shared_array_noinit_test.cpp +++ b/test/allocate_shared_array_noinit_test.cpp @@ -114,8 +114,7 @@ int main() } { boost::shared_ptr result = - boost::allocate_shared_noinit(creator(), 3); + boost::allocate_shared_noinit(creator(), 3); BOOST_TEST(result.get() != 0); BOOST_TEST(result.use_count() == 1); BOOST_TEST(boost::alignment::is_aligned(result.get(), @@ -131,8 +130,7 @@ int main() } { boost::shared_ptr result = - boost::allocate_shared_noinit(creator(), 2); + boost::allocate_shared_noinit(creator(), 2); BOOST_TEST(result.get() != 0); BOOST_TEST(result.use_count() == 1); BOOST_TEST(boost::alignment::is_aligned(result.get(), @@ -140,8 +138,7 @@ int main() } { boost::shared_ptr result = - boost::allocate_shared_noinit(creator()); + boost::allocate_shared_noinit(creator()); BOOST_TEST(result.get() != 0); BOOST_TEST(result.use_count() == 1); BOOST_TEST(boost::alignment::is_aligned(result.get(), @@ -197,8 +194,7 @@ int main() } { boost::shared_ptr result = - boost::allocate_shared_noinit(creator(), 3); + boost::allocate_shared_noinit(creator(), 3); BOOST_TEST(result.get() != 0); BOOST_TEST(result.use_count() == 1); BOOST_TEST(boost::alignment::is_aligned(result.get(), @@ -210,8 +206,7 @@ int main() } { boost::shared_ptr result = - boost::allocate_shared_noinit(creator()); + boost::allocate_shared_noinit(creator()); BOOST_TEST(result.get() != 0); BOOST_TEST(result.use_count() == 1); BOOST_TEST(boost::alignment::is_aligned(result.get(), @@ -236,8 +231,7 @@ int main() } { boost::shared_ptr result = - boost::allocate_shared_noinit(creator()); + boost::allocate_shared_noinit(creator()); BOOST_TEST(result.get() != 0); BOOST_TEST(result.use_count() == 1); BOOST_TEST(boost::alignment::is_aligned(result.get(), diff --git a/test/allocate_shared_arrays_test.cpp b/test/allocate_shared_arrays_test.cpp index a088a22..3c4f601 100644 --- a/test/allocate_shared_arrays_test.cpp +++ b/test/allocate_shared_arrays_test.cpp @@ -66,8 +66,7 @@ int main() } { boost::shared_ptr result = - boost::allocate_shared(creator(), 2, {0, 1}); + boost::allocate_shared(creator(), 2, {0, 1}); BOOST_TEST(result[0][0] == 0); BOOST_TEST(result[0][1] == 1); BOOST_TEST(result[1][0] == 0); @@ -75,8 +74,7 @@ int main() } { boost::shared_ptr result = - boost::allocate_shared(creator(), {0, 1}); + boost::allocate_shared(creator(), {0, 1}); BOOST_TEST(result[0][0] == 0); BOOST_TEST(result[0][1] == 1); BOOST_TEST(result[1][0] == 0);