From 57dc400fbfccf31737e92cca8ce1a6e9912c326c Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Mon, 10 Feb 2014 21:04:41 -0800 Subject: [PATCH] Cosmetic changes in make_shared and make_unique --- include/boost/smart_ptr/allocate_shared_array.hpp | 14 +++++++------- include/boost/smart_ptr/detail/up_if_array.hpp | 4 ++-- include/boost/smart_ptr/detail/up_if_not_array.hpp | 6 +++--- include/boost/smart_ptr/make_shared_array.hpp | 12 ++++++------ include/boost/smart_ptr/make_unique_array.hpp | 4 ++-- include/boost/smart_ptr/make_unique_object.hpp | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index aca4920..b260520 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -26,7 +26,7 @@ namespace boost { T2* p2 = 0; D1 d1; A1 a1(allocator, size, &p2); - shared_ptr s1(p1, d1, a1); + shared_ptr s1(p1, d1, a1); #if !defined(BOOST_NO_CXX11_ALLOCATOR) boost::detail::as_init(allocator, p2, n1); #else @@ -53,7 +53,7 @@ namespace boost { T2* p2 = 0; D1 d1; A1 a1(allocator, &p2); - shared_ptr s1(p1, d1, a1); + shared_ptr s1(p1, d1, a1); #if !defined(BOOST_NO_CXX11_ALLOCATOR) boost::detail::as_init(allocator, p2, N); #else @@ -84,7 +84,7 @@ namespace boost { T3* p3 = reinterpret_cast(&value); D1 d1; A1 a1(allocator, size, &p2); - shared_ptr s1(p1, d1, a1); + shared_ptr s1(p1, d1, a1); #if !defined(BOOST_NO_CXX11_ALLOCATOR) boost::detail::as_init(allocator, p2, n1, p3); #else @@ -115,7 +115,7 @@ namespace boost { T3* p3 = reinterpret_cast(&value); D1 d1; A1 a1(allocator, &p2); - shared_ptr s1(p1, d1, a1); + shared_ptr s1(p1, d1, a1); #if !defined(BOOST_NO_CXX11_ALLOCATOR) boost::detail::as_init(allocator, p2, N, p3); #else @@ -137,10 +137,10 @@ namespace boost { typedef boost::detail::ms_noop D1; std::size_t n1 = size * boost::detail::array_total::size; T1* p1 = 0; - T2* p2 = 0; + T2* p2 = 0; D1 d1; A1 a1(allocator, size, &p2); - shared_ptr s1(p1, d1, a1); + shared_ptr s1(p1, d1, a1); boost::detail::ms_noinit(p2, n1); A1* a2 = static_cast(s1._internal_get_untyped_deleter()); a2->set(p2); @@ -163,7 +163,7 @@ namespace boost { T2* p2 = 0; D1 d1; A1 a1(allocator, &p2); - shared_ptr s1(p1, d1, a1); + shared_ptr s1(p1, d1, a1); boost::detail::ms_noinit(p2, N); A1* a2 = static_cast(s1._internal_get_untyped_deleter()); a2->set(p2); diff --git a/include/boost/smart_ptr/detail/up_if_array.hpp b/include/boost/smart_ptr/detail/up_if_array.hpp index d0b197d..7e62d10 100644 --- a/include/boost/smart_ptr/detail/up_if_array.hpp +++ b/include/boost/smart_ptr/detail/up_if_array.hpp @@ -13,10 +13,10 @@ namespace boost { namespace detail { - template + template struct up_if_array; - template + template struct up_if_array { typedef std::unique_ptr type; }; diff --git a/include/boost/smart_ptr/detail/up_if_not_array.hpp b/include/boost/smart_ptr/detail/up_if_not_array.hpp index 7679e61..fd74f25 100644 --- a/include/boost/smart_ptr/detail/up_if_not_array.hpp +++ b/include/boost/smart_ptr/detail/up_if_not_array.hpp @@ -13,16 +13,16 @@ namespace boost { namespace detail { - template + template struct up_if_not_array { typedef std::unique_ptr type; }; - template + template struct up_if_not_array { }; - template + template struct up_if_not_array { }; } diff --git a/include/boost/smart_ptr/make_shared_array.hpp b/include/boost/smart_ptr/make_shared_array.hpp index 65eb76f..cfd390d 100644 --- a/include/boost/smart_ptr/make_shared_array.hpp +++ b/include/boost/smart_ptr/make_shared_array.hpp @@ -21,7 +21,7 @@ namespace boost { typedef boost::detail::ms_init_tag R1; typedef boost::detail::ms_allocator A1; typedef boost::detail::ms_noop D1; - std::size_t n1 = size * boost::detail::array_total::size; + std::size_t n1 = size * boost::detail::array_total::size; T1* p1 = 0; T2* p2 = 0; D1 d1; @@ -50,10 +50,10 @@ namespace boost { D1 d1; A1 a1(&p2); shared_ptr s1(p1, d1, a1); - p1 = reinterpret_cast(p2); boost::detail::ms_init(p2, N); A1* a2 = static_cast(s1._internal_get_untyped_deleter()); a2->set(p2); + p1 = reinterpret_cast(p2); return shared_ptr(s1, p1); } @@ -96,7 +96,7 @@ namespace boost { enum { M = boost::detail::array_total::size, N = boost::detail::array_total::size - }; + }; T1* p1 = 0; T2* p2 = 0; T3* p3 = reinterpret_cast(&value); @@ -118,16 +118,16 @@ namespace boost { typedef boost::detail::ms_noinit_tag R1; typedef boost::detail::ms_allocator A1; typedef boost::detail::ms_noop D1; - std::size_t n1 = size * boost::detail::array_total::size; + std::size_t n1 = size * boost::detail::array_total::size; T1* p1 = 0; T2* p2 = 0; D1 d1; A1 a1(n1, &p2); shared_ptr s1(p1, d1, a1); - p1 = reinterpret_cast(p2); boost::detail::ms_noinit(p2, n1); A1* a2 = static_cast(s1._internal_get_untyped_deleter()); a2->set(p2); + p1 = reinterpret_cast(p2); return shared_ptr(s1, p1); } @@ -147,10 +147,10 @@ namespace boost { D1 d1; A1 a1(&p2); shared_ptr s1(p1, d1, a1); - p1 = reinterpret_cast(p2); boost::detail::ms_noinit(p2, N); A1* a2 = static_cast(s1._internal_get_untyped_deleter()); a2->set(p2); + p1 = reinterpret_cast(p2); return shared_ptr(s1, p1); } } diff --git a/include/boost/smart_ptr/make_unique_array.hpp b/include/boost/smart_ptr/make_unique_array.hpp index 987c565..eb0528e 100644 --- a/include/boost/smart_ptr/make_unique_array.hpp +++ b/include/boost/smart_ptr/make_unique_array.hpp @@ -13,14 +13,14 @@ #include namespace boost { - template + template inline typename boost::detail::up_if_array::type make_unique(std::size_t size) { typedef typename boost::detail::array_inner::type U; return std::unique_ptr(new U[size]()); } - template + template inline typename boost::detail::up_if_array::type make_unique_noinit(std::size_t size) { typedef typename boost::detail::array_inner::type U; diff --git a/include/boost/smart_ptr/make_unique_object.hpp b/include/boost/smart_ptr/make_unique_object.hpp index 12149c5..c392e24 100644 --- a/include/boost/smart_ptr/make_unique_object.hpp +++ b/include/boost/smart_ptr/make_unique_object.hpp @@ -14,27 +14,27 @@ #include namespace boost { - template + template inline typename boost::detail::up_if_not_array::type make_unique() { return std::unique_ptr(new T()); } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template + template inline typename boost::detail::up_if_not_array::type make_unique(Args&&... args) { return std::unique_ptr(new T(std::forward(args)...)); } #endif - template + template inline typename boost::detail::up_if_not_array::type make_unique(T&& value) { return std::unique_ptr(new T(std::move(value))); } - template + template inline typename boost::detail::up_if_not_array::type make_unique_noinit() { return std::unique_ptr(new T);