diff --git a/include/boost/smart_ptr/detail/array_allocator.hpp b/include/boost/smart_ptr/detail/array_allocator.hpp index 8f1e632..79bae59 100644 --- a/include/boost/smart_ptr/detail/array_allocator.hpp +++ b/include/boost/smart_ptr/detail/array_allocator.hpp @@ -28,6 +28,12 @@ namespace boost { size(size_ * array_total::size) { } + template + as_size_base(const as_size_base& other) + : A(other), + size(other.size) { + } + std::size_t size; }; @@ -38,6 +44,11 @@ namespace boost { : A(allocator) { } + template + as_size_base(const as_size_base& other) + : A(other) { + } + enum { size = array_total::size }; @@ -58,9 +69,13 @@ namespace boost { template class as_allocator - : as_size_base { - using as_size_base::size; - +#if !defined(BOOST_NO_CXX11_ALLOCATOR) + : as_size_base:: + template rebind_alloc > { +#else + : as_size_base::other> { +#endif template friend class as_allocator; @@ -78,6 +93,8 @@ namespace boost { typedef typename A::template rebind::other CA; #endif + using as_size_base::size; + public: typedef typename array_base::type type; @@ -105,36 +122,30 @@ namespace boost { }; as_allocator(const A& allocator, type** result) - : as_size_base(allocator), + : as_size_base(allocator), data(result) { } as_allocator(const A& allocator, std::size_t size_, type** result) - : as_size_base(allocator, size_), + : as_size_base(allocator, size_), data(result) { } template as_allocator(const as_allocator& other) - : as_size_base(other), + : as_size_base(other), data(other.data) { } - pointer address(reference value) const { - YA ya(*this); - return ya.address(value); - } - - const_pointer address(const_reference value) const { - YA ya(*this); - return ya.address(value); - } - +#if !defined(BOOST_NO_CXX11_ALLOCATOR) size_type max_size() const { - YA ya(*this); - return ya.max_size(); + return YT::max_size(*this); } +#else + using YA::address; + using YA::max_size; +#endif pointer allocate(size_type count, const void* value = 0) { enum { @@ -171,21 +182,19 @@ namespace boost { template void construct(U* memory, const_reference value) { - YA ya(*this); #if !defined(BOOST_NO_CXX11_ALLOCATOR) - YT::construct(ya, memory, value); + YT::construct(*this, memory, value); #else - ya.construct(memory, value); + YA::construct(memory, value); #endif } template void destroy(U* memory) { - YA ya(*this); #if !defined(BOOST_NO_CXX11_ALLOCATOR) - YT::destroy(ya, memory); + YT::destroy(*this, memory); #else - ya.destroy(memory); + YA::destroy(memory); #endif } @@ -194,8 +203,7 @@ namespace boost { !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template void construct(U* memory, Args&&... args) { - YA ya(*this); - YT::construct(ya, memory, std::forward(args)...); + YT::construct(*this, memory, std::forward(args)...); } #endif @@ -223,8 +231,7 @@ namespace boost { private: void free(ms_init_tag) { #if !defined(BOOST_NO_CXX11_ALLOCATOR) - const A& a1(*this); - as_destroy(a1, data.object, size); + as_destroy(*this, data.object, size); #else ms_destroy(data.object, size); #endif @@ -295,6 +302,7 @@ namespace boost { data(other.data) { } +#if defined(BOOST_NO_CXX11_ALLOCATOR) pointer address(reference value) const { return &value; } @@ -302,6 +310,7 @@ namespace boost { const_pointer address(const_reference value) const { return &value; } +#endif size_type max_size() const { enum { diff --git a/include/boost/smart_ptr/detail/array_count_impl.hpp b/include/boost/smart_ptr/detail/array_count_impl.hpp index f81954d..b7c9617 100644 --- a/include/boost/smart_ptr/detail/array_count_impl.hpp +++ b/include/boost/smart_ptr/detail/array_count_impl.hpp @@ -20,7 +20,7 @@ namespace boost { typedef ms_in_allocator_tag D; typedef sp_counted_impl_pda Y; public: - sp_counted_impl_pda(P, const D&, const A& allocator_) + sp_counted_impl_pda(P, D, const A& allocator_) : allocator(allocator_) { } diff --git a/make_shared_array.html b/make_shared_array.html index 56341cd..ebfaeda 100644 --- a/make_shared_array.html +++ b/make_shared_array.html @@ -30,50 +30,50 @@ user-supplied allocator, allowing finer control.

Synopsis

namespace boost {
-    template<typename U> // U is T[]
+    template<class U> // U is T[]
     shared_ptr<U> make_shared(size_t size);
 
-    template<typename U, typename A> // U is T[]
+    template<class U, class A> // U is T[]
     shared_ptr<U> allocate_shared(const A& allocator, size_t size);
 
-    template<typename U> // U is T[N]
+    template<class U> // U is T[N]
     shared_ptr<U> make_shared();
 
-    template<typename U, typename A> // U is T[N]
+    template<class U, class A> // U is T[N]
     shared_ptr<U> allocate_shared(const A& allocator);
 
-    template<typename U> // U is T[]
+    template<class U> // U is T[]
     shared_ptr<U> make_shared(size_t size, const T& value);
 
-    template<typename U, typename A>  // U is T[]
+    template<class U, class A>  // U is T[]
     shared_ptr<U> allocate_shared(const A& allocator, size_t size, const T& value);
 
-    template<typename U> // U is T[N]
+    template<class U> // U is T[N]
     shared_ptr<U> make_shared(const T& value);
 
-    template<typename U, typename A> // U is T[N]
+    template<class U, class A> // U is T[N]
     shared_ptr<U> allocate_shared(const A& allocator, const T& value);
 
-    template<typename U> // U is T[]
+    template<class U> // U is T[]
     shared_ptr<U> make_shared_noinit(size_t size);
 
-    template<typename U, typename A> // U is T[]
+    template<class U, class A> // U is T[]
     shared_ptr<U> allocate_shared_noinit(const A& allocator, size_t size);
 
-    template<typename U> // U is T[N]
+    template<class U> // U is T[N]
     shared_ptr<U> make_shared_noinit();
 
-    template<typename U, typename A> // U is T[N]
+    template<class U, class A> // U is T[N]
     shared_ptr<U> allocate_shared_noinit(const A& allocator);
 }

Common Requirements

-
template<typename U>
+    
template<class U>
     shared_ptr<U> make_shared(args);
-template<typename U, typename A>
+template<class U, class A>
     shared_ptr<U> allocate_shared(const A& allocator, args);
-template<typename U>
+template<class U>
     shared_ptr<U> make_shared_noinit(args);
-template<typename U, typename A>
+template<class U, class A>
     shared_ptr<U> allocate_shared_noinit(const A& allocator, args);

Requires: U is of the form T[] or @@ -157,9 +157,9 @@ template<typename U, typename A> structures such as the reference counts.

Free Functions

-
template<typename U> 
+    
template<class U> 
     shared_ptr<U> make_shared(size_t size);
-template<typename U, typename A> 
+template<class U, class A> 
     shared_ptr<U> allocate_shared(const A& allocator, size_t size);

Returns: A shared_ptr to a value-initialized @@ -172,9 +172,9 @@ template<typename U, typename A> boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size);

-
template<typename U> 
+    
template<class U> 
     shared_ptr<U> make_shared();
-template<typename U, typename A> 
+template<class U, class A> 
     shared_ptr<U> allocate_shared(const A& allocator);

Returns: A shared_ptr to a value-initialized @@ -187,9 +187,9 @@ template<typename U, typename A> boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>();

-
template<typename U> 
+    
template<class U> 
     shared_ptr<U> make_shared(size_t size, const T& value);
-template<typename U, typename A> 
+template<class U, class A> 
     shared_ptr<U> allocate_shared(const A& allocator, size_t size, const T& value);

Returns: A shared_ptr to an object of type @@ -203,9 +203,9 @@ template<typename U, typename A> boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size, {1, 2});

-
template<typename U> 
+    
template<class U> 
     shared_ptr<U> make_shared(const T& value);
-template<typename U, typename A> 
+template<class U, class A> 
     shared_ptr<U> allocate_shared(const A& allocator, const T& value);

Returns: A shared_ptr to an object of type @@ -219,9 +219,9 @@ template<typename U, typename A> boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>({1, 2});

-
template<typename U> 
+    
template<class U> 
     shared_ptr<U> make_shared_noinit(size_t size);
-template<typename U, typename A> 
+template<class U, class A> 
     shared_ptr<U> allocate_shared_noinit(const A& allocator, size_t size);

Returns: A shared_ptr to a default-initialized @@ -234,9 +234,9 @@ template<typename U, typename A> boost::shared_ptr<int[][2]> a2 = boost::make_shared_noinit<int[][2]>(size);

-
template<typename U> 
+    
template<class U> 
     shared_ptr<U> make_shared_noinit();
-template<typename U, typename A> 
+template<class U, class A> 
     shared_ptr<U> allocate_shared_noinit(const A& allocator);

Returns: A shared_ptr to a default-initialized diff --git a/make_unique.html b/make_unique.html index c3e6ab8..5b414e8 100644 --- a/make_unique.html +++ b/make_unique.html @@ -18,30 +18,30 @@ unique_ptr objects.

Synopsis

namespace boost {
-    template<typename U> // U is not array
+    template<class U> // U is not array
     unique_ptr<U> make_unique();
 
 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
-    template<typename U, typename... Args> // U is not array
+    template<class U, class... Args> // U is not array
     unique_ptr<U> make_unique(Args&&... args);
 #endif
 
-    template<typename U> // U is not array
+    template<class U> // U is not array
     unique_ptr<U> make_unique(U&& value);
 
-    template<typename U> // U is T[]
+    template<class U> // U is T[]
     unique_ptr<U> make_unique(size_t size);
 
-    template<typename U> // U is not array
+    template<class U> // U is not array
     unique_ptr<U> make_unique_noinit();
 
-    template<typename U> // U is T[]
+    template<class U> // U is T[]
     unique_ptr<U> make_unique_noinit(size_t size);
 }

Common Requirements

-
template<typename U>
+    
template<class U>
     unique_ptr<U> make_unique(args);
-template<typename U>
+template<class U>
     unique_ptr<U> make_unique_noinit(args);

Effects: Allocates memory for an object of type U @@ -73,7 +73,7 @@ template<typename U>

Free Functions

-
template<typename U, typename... Args>
+    
template<class U, class... Args>
 unique_ptr<U> make_unique(Args&&... args);

Returns: A unique_ptr to an object of type U, @@ -86,7 +86,7 @@ unique_ptr<U> make_unique(Args&&... args);

unique_ptr<point> p2 = boost::make_unique<point>(x, y);
-
template<typename U>
+    
template<class U>
 unique_ptr<U> make_unique(U&& value);

Returns: A unique_ptr to an object of type U, @@ -99,7 +99,7 @@ unique_ptr<U> make_unique(U&& value);

unique_ptr<point> p2 = boost::make_unique<point>({-10, 25});
-
template<typename U>
+    
template<class U>
 unique_ptr<U> make_unique(size_t size);

Returns: A unique_ptr to a value-initialized object of type @@ -112,7 +112,7 @@ unique_ptr<U> make_unique(size_t size);

unique_ptr<int[][2]> p2 = boost::make_unique<int[][2]>(2); -
template<typename U>
+    
template<class U>
 unique_ptr<U> make_unique_noinit();

Returns: A unique_ptr to a default-initialized object of @@ -125,7 +125,7 @@ unique_ptr<U> make_unique_noinit();

unique_ptr<point> p2 = boost::make_unique_noinit<point>(); -
template<typename U>
+    
template<class U>
 unique_ptr<U> make_unique_noinit(size_t size);

Returns: A unique_ptr to a default-initialized object of