Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81610 - in trunk/boost/smart_ptr: . detail
From: glenfe_at_[hidden]
Date: 2012-11-28 02:32:31


Author: glenfe
Date: 2012-11-28 02:32:30 EST (Wed, 28 Nov 2012)
New Revision: 81610
URL: http://svn.boost.org/trac/boost/changeset/81610

Log:
More consistency in type parameters in helper details of allocate_shared and make_shared.
Text files modified:
   trunk/boost/smart_ptr/allocate_shared_array.hpp | 32 ++++++++++++++++----------------
   trunk/boost/smart_ptr/detail/allocate_array_helper.hpp | 14 ++++++++------
   trunk/boost/smart_ptr/detail/array_deleter.hpp | 4 +++-
   trunk/boost/smart_ptr/detail/make_array_helper.hpp | 14 ++++++++------
   trunk/boost/smart_ptr/make_shared_array.hpp | 40 ++++++++++++++++++++--------------------
   5 files changed, 55 insertions(+), 49 deletions(-)

Modified: trunk/boost/smart_ptr/allocate_shared_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/allocate_shared_array.hpp (original)
+++ trunk/boost/smart_ptr/allocate_shared_array.hpp 2012-11-28 02:32:30 EST (Wed, 28 Nov 2012)
@@ -28,12 +28,12 @@
         T1* p1 = 0;
         T2* p2 = 0;
         std::size_t n1 = size * boost::detail::array_total<T1>::size;
- boost::detail::allocate_array_helper<A, T2> a1(allocator, n1, &p2);
- boost::detail::array_deleter<T2> d1;
+ boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
+ boost::detail::array_deleter<T2[]> d1;
         boost::shared_ptr<T> s1(p1, d1, a1);
- boost::detail::array_deleter<T2>* d2;
+ boost::detail::array_deleter<T2[]>* d2;
         p1 = reinterpret_cast<T1*>(p2);
- d2 = get_deleter<boost::detail::array_deleter<T2> >(s1);
+ d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
         d2->construct(p2, n1);
         return boost::shared_ptr<T>(s1, p1);
     }
@@ -46,12 +46,12 @@
         T1* p1 = 0;
         T2* p2 = 0;
         std::size_t n1 = size * boost::detail::array_total<T1>::size;
- boost::detail::allocate_array_helper<A, T2> a1(allocator, n1, &p2);
- boost::detail::array_deleter<T2> d1;
+ boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
+ boost::detail::array_deleter<T2[]> d1;
         boost::shared_ptr<T> s1(p1, d1, a1);
- boost::detail::array_deleter<T2>* d2;
+ boost::detail::array_deleter<T2[]>* d2;
         p1 = reinterpret_cast<T1*>(p2);
- d2 = get_deleter<boost::detail::array_deleter<T2> >(s1);
+ d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
         d2->construct(p2, n1, boost::detail::sp_forward<Args>(args)...);
         return boost::shared_ptr<T>(s1, p1);
     }
@@ -85,13 +85,13 @@
         T2* p2 = 0;
         T3* p3 = 0;
         std::size_t n1 = list.size() * boost::detail::array_total<T1>::size;
- boost::detail::allocate_array_helper<A, T2> a1(allocator, n1, &p2);
- boost::detail::array_deleter<T2> d1;
+ boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
+ boost::detail::array_deleter<T2[]> d1;
         boost::shared_ptr<T> s1(p1, d1, a1);
- boost::detail::array_deleter<T2>* d2;
+ boost::detail::array_deleter<T2[]>* d2;
         p3 = reinterpret_cast<T3*>(list.begin());
         p1 = reinterpret_cast<T1*>(p2);
- d2 = get_deleter<boost::detail::array_deleter<T2> >(s1);
+ d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
         d2->construct_list(p2, n1, p3);
         return boost::shared_ptr<T>(s1, p1);
     }
@@ -129,13 +129,13 @@
         T3* p3 = 0;
         enum { M = boost::detail::array_total<T1>::size };
         std::size_t n1 = M * list.size();
- boost::detail::allocate_array_helper<A, T2> a1(allocator, n1, &p2);
- boost::detail::array_deleter<T2> d1;
+ boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
+ boost::detail::array_deleter<T2[]> d1;
         boost::shared_ptr<T> s1(p1, d1, a1);
- boost::detail::array_deleter<T2>* d2;
+ boost::detail::array_deleter<T2[]>* d2;
         p3 = reinterpret_cast<T3*>(list.begin());
         p1 = reinterpret_cast<T1*>(p2);
- d2 = get_deleter<boost::detail::array_deleter<T2> >(s1);
+ d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
         d2->construct_list(p2, n1, p3, M);
         return boost::shared_ptr<T>(s1, p1);
     }

Modified: trunk/boost/smart_ptr/detail/allocate_array_helper.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/allocate_array_helper.hpp (original)
+++ trunk/boost/smart_ptr/detail/allocate_array_helper.hpp 2012-11-28 02:32:30 EST (Wed, 28 Nov 2012)
@@ -13,8 +13,10 @@
 
 namespace boost {
     namespace detail {
- template<typename A, typename T, typename Y = T>
- class allocate_array_helper {
+ template<typename A, typename T, typename Y = char>
+ class allocate_array_helper;
+ template<typename A, typename T, typename Y>
+ class allocate_array_helper<A, T[], Y> {
             template<typename A9, typename T9, typename Y9>
             friend class allocate_array_helper;
             typedef typename A::template rebind<Y> ::other A2;
@@ -29,7 +31,7 @@
             typedef typename A2::difference_type difference_type;
             template<typename U>
             struct rebind {
- typedef allocate_array_helper<A, T, U> other;
+ typedef allocate_array_helper<A, T[], U> other;
             };
             allocate_array_helper(const A& allocator, std::size_t size, T** data)
                 : allocator(allocator),
@@ -37,7 +39,7 @@
                   data(data) {
             }
             template<class U>
- allocate_array_helper(const allocate_array_helper<A, T, U>& other)
+ allocate_array_helper(const allocate_array_helper<A, T[], U>& other)
                 : allocator(other.allocator),
                   size(other.size),
                   data(other.data) {
@@ -75,11 +77,11 @@
                 allocator.destroy(memory);
             }
             template<typename U>
- bool operator==(const allocate_array_helper<A, T, U>& other) const {
+ bool operator==(const allocate_array_helper<A, T[], U>& other) const {
                 return allocator == other.allocator;
             }
             template<typename U>
- bool operator!=(const allocate_array_helper<A, T, U>& other) const {
+ bool operator!=(const allocate_array_helper<A, T[], U>& other) const {
                 return !(*this == other);
             }
         private:

Modified: trunk/boost/smart_ptr/detail/array_deleter.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/array_deleter.hpp (original)
+++ trunk/boost/smart_ptr/detail/array_deleter.hpp 2012-11-28 02:32:30 EST (Wed, 28 Nov 2012)
@@ -15,7 +15,9 @@
 namespace boost {
     namespace detail {
         template<typename T>
- class array_deleter {
+ class array_deleter;
+ template<typename T>
+ class array_deleter<T[]> {
         public:
             array_deleter()
                 : size(0) {

Modified: trunk/boost/smart_ptr/detail/make_array_helper.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/make_array_helper.hpp (original)
+++ trunk/boost/smart_ptr/detail/make_array_helper.hpp 2012-11-28 02:32:30 EST (Wed, 28 Nov 2012)
@@ -13,8 +13,10 @@
 
 namespace boost {
     namespace detail {
- template<typename T, typename Y = T>
- class make_array_helper {
+ template<typename T, typename Y = char>
+ class make_array_helper;
+ template<typename T, typename Y>
+ class make_array_helper<T[], Y> {
             template<typename T2, typename Y2>
             friend class make_array_helper;
         public:
@@ -27,14 +29,14 @@
             typedef ptrdiff_t difference_type;
             template<typename U>
             struct rebind {
- typedef make_array_helper<T, U> other;
+ typedef make_array_helper<T[], U> other;
             };
             make_array_helper(std::size_t size, T** data)
                 : size(sizeof(T) * size),
                   data(data) {
             }
             template<class U>
- make_array_helper(const make_array_helper<T, U>& other)
+ make_array_helper(const make_array_helper<T[], U>& other)
                 : size(other.size),
                   data(other.data) {
             }
@@ -70,11 +72,11 @@
                 memory->~Y();
             }
             template<typename U>
- bool operator==(const make_array_helper<T, U>& other) const {
+ bool operator==(const make_array_helper<T[], U>& other) const {
                 return true;
             }
             template<typename U>
- bool operator!=(const make_array_helper<T, U>& other) const {
+ bool operator!=(const make_array_helper<T[], U>& other) const {
                 return !(*this == other);
             }
         private:

Modified: trunk/boost/smart_ptr/make_shared_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/make_shared_array.hpp (original)
+++ trunk/boost/smart_ptr/make_shared_array.hpp 2012-11-28 02:32:30 EST (Wed, 28 Nov 2012)
@@ -28,12 +28,12 @@
         T1* p1 = 0;
         T2* p2 = 0;
         std::size_t n1 = size * boost::detail::array_total<T1>::size;
- boost::detail::make_array_helper<T2> a1(n1, &p2);
- boost::detail::array_deleter<T2> d1;
+ boost::detail::make_array_helper<T2[]> a1(n1, &p2);
+ boost::detail::array_deleter<T2[]> d1;
         boost::shared_ptr<T> s1(p1, d1, a1);
- boost::detail::array_deleter<T2>* d2;
+ boost::detail::array_deleter<T2[]>* d2;
         p1 = reinterpret_cast<T1*>(p2);
- d2 = get_deleter<boost::detail::array_deleter<T2> >(s1);
+ d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
         d2->construct(p2, n1);
         return boost::shared_ptr<T>(s1, p1);
     }
@@ -46,12 +46,12 @@
         T1* p1 = 0;
         T2* p2 = 0;
         std::size_t n1 = size * boost::detail::array_total<T1>::size;
- boost::detail::make_array_helper<T2> a1(n1, &p2);
- boost::detail::array_deleter<T2> d1;
+ boost::detail::make_array_helper<T2[]> a1(n1, &p2);
+ boost::detail::array_deleter<T2[]> d1;
         boost::shared_ptr<T> s1(p1, d1, a1);
- boost::detail::array_deleter<T2>* d2;
+ boost::detail::array_deleter<T2[]>* d2;
         p1 = reinterpret_cast<T1*>(p2);
- d2 = get_deleter<boost::detail::array_deleter<T2> >(s1);
+ d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
         d2->construct(p2, n1, boost::detail::sp_forward<Args>(args)...);
         return boost::shared_ptr<T>(s1, p1);
     }
@@ -84,13 +84,13 @@
         T2* p2 = 0;
         T3* p3 = 0;
         std::size_t n1 = list.size() * boost::detail::array_total<T1>::size;
- boost::detail::make_array_helper<T2> a1(n1, &p2);
- boost::detail::array_deleter<T2> d1;
+ boost::detail::make_array_helper<T2[]> a1(n1, &p2);
+ boost::detail::array_deleter<T2[]> d1;
         boost::shared_ptr<T> s1(p1, d1, a1);
- boost::detail::array_deleter<T2>* d2;
+ boost::detail::array_deleter<T2[]>* d2;
         p3 = reinterpret_cast<T3*>(list.begin());
         p1 = reinterpret_cast<T1*>(p2);
- d2 = get_deleter<boost::detail::array_deleter<T2> >(s1);
+ d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
         d2->construct_list(p2, n1, p3);
         return boost::shared_ptr<T>(s1, p1);
     }
@@ -127,13 +127,13 @@
         T3* p3 = 0;
         enum { M = boost::detail::array_total<T1>::size };
         std::size_t n1 = M * size;
- boost::detail::make_array_helper<T2> a1(n1, &p2);
- boost::detail::array_deleter<T2> d1;
+ boost::detail::make_array_helper<T2[]> a1(n1, &p2);
+ boost::detail::array_deleter<T2[]> d1;
         boost::shared_ptr<T> s1(p1, d1, a1);
- boost::detail::array_deleter<T2>* d2;
+ boost::detail::array_deleter<T2[]>* d2;
         p3 = reinterpret_cast<T3*>(list.begin());
         p1 = reinterpret_cast<T1*>(p2);
- d2 = get_deleter<boost::detail::array_deleter<T2> >(s1);
+ d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
         d2->construct_list(p2, n1, p3, M);
         return boost::shared_ptr<T>(s1, p1);
     }
@@ -168,12 +168,12 @@
         T1* p1 = 0;
         T2* p2 = 0;
         std::size_t n1 = size * boost::detail::array_total<T1>::size;
- boost::detail::make_array_helper<T2> a1(n1, &p2);
- boost::detail::array_deleter<T2> d1;
+ boost::detail::make_array_helper<T2[]> a1(n1, &p2);
+ boost::detail::array_deleter<T2[]> d1;
         boost::shared_ptr<T> s1(p1, d1, a1);
- boost::detail::array_deleter<T2>* d2;
+ boost::detail::array_deleter<T2[]>* d2;
         p1 = reinterpret_cast<T1*>(p2);
- d2 = get_deleter<boost::detail::array_deleter<T2> >(s1);
+ d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
         d2->construct_noinit(p2, n1);
         return boost::shared_ptr<T>(s1, p1);
     }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk