diff --git a/make_shared_array.html b/make_shared_array.html index 326bb10..2b9b5bd 100644 --- a/make_shared_array.html +++ b/make_shared_array.html @@ -29,85 +29,85 @@ allowing finer control.

Synopsis

namespace boost {
-    template<typename T>
-    shared_ptr<T[]> make_shared(size_t size);
+    template<typename U> // U = T[]
+    shared_ptr<U> make_shared(size_t size);
 
-    template<typename T, typename A>
-    shared_ptr<T[]> allocate_shared(const A& allocator, size_t size);
-    
-#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-    template<typename T, typename... Args>
-    shared_ptr<T[]> make_shared(size_t size, Args&&... args);
+    template<typename U, typename A> // U = T[]
+    shared_ptr<U> allocate_shared(const A& allocator, size_t size);
 
-    template<typename T, typename... Args>
-    shared_ptr<T[N]> make_shared(Args&&... args);
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)   
+    template<typename U, typename... Args> // U = T[]
+    shared_ptr<U> make_shared(size_t size, Args&&... args);
 
-    template<typename T, typename A, typename... Args>
-    shared_ptr<T[]> allocate_shared(const A& allocator, size_t size, Args&&... args);
+    template<typename U, typename... Args> // U = T[N]
+    shared_ptr<U> make_shared(Args&&... args);
 
-    template<typename T, typename A, typename... Args>
-    shared_ptr<T[N]> allocate_shared(const A& allocator, Args&&... args);
+    template<typename U, typename A, typename... Args> // U = T[]
+    shared_ptr<U> allocate_shared(const A& allocator, size_t size, Args&&... args);
+
+    template<typename U, typename A, typename... Args> // U = T[N]
+    shared_ptr<U> allocate_shared(const A& allocator, Args&&... args);
 #endif
-        
-#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
-    template<typename T, typename... Args>
-    shared_ptr<T[N]> make_shared(const T (&list)[N]);
 
-    template<typename T, typename... Args>
-    shared_ptr<T[][N]> make_shared(size_t size, const T (&list)[N]);
+#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)    
+    template<typename U, typename... Args> // U = T[N]
+    shared_ptr<U> make_shared(const T (&list)[N]);
 
-    template<typename T, typename... Args>
-    shared_ptr<T[M][N]> make_shared(const T (&list)[N]);
+    template<typename U, typename... Args> // U = T[][N]
+    shared_ptr<U> make_shared(size_t size, const T (&list)[N]);
 
-    template<typename T, typename A, typename... Args>
-    shared_ptr<T[N]> allocate_shared(const A& allocator, const T (&list)[N]);
+    template<typename U, typename... Args> // U = T[M][N]
+    shared_ptr<U> make_shared(const T (&list)[N]);
 
-    template<typename T, typename A, typename... Args>
-    shared_ptr<T[][N]> allocate_shared(const A& allocator, size_t size, const T (&list)[N]);
+    template<typename U, typename A, typename... Args> // U = T[N]
+    shared_ptr<T[> allocate_shared(const A& allocator, const T (&list)[N]);
 
-    template<typename T, typename A, typename... Args>
-    shared_ptr<T[M][N]> allocate_shared(const A& allocator, const T (&list)[N]);
+    template<typename U, typename A, typename... Args> // U = T[][N]
+    shared_ptr<U> allocate_shared(const A& allocator, size_t size, const T (&list)[N]);
+
+    template<typename U, typename A, typename... Args> // U = T[M][N]
+    shared_ptr<U> allocate_shared(const A& allocator, const T (&list)[N]);
 
 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
-    template<typename T, typename... Args>
-    shared_ptr<T[]> make_shared(initializer_list<T> list);
+    template<typename U, typename... Args> // U = T[]
+    shared_ptr<U> make_shared(initializer_list<T> list);
 
-    template<typename T, typename A, typename... Args>
-    shared_ptr<T[]> allocate_shared(const A& allocator, initializer_list<T> list);
+    template<typename U, typename A, typename... Args> // U = T[]
+    shared_ptr<U> allocate_shared(const A& allocator, initializer_list<T> list);
 #endif
 
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-    template<typename T>
-    shared_ptr<T[]> make_shared(size_t size, T&& value);
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)    
+    template<typename U> // U = T[]
+    shared_ptr<U> make_shared(size_t size, T&& value);
 
-    template<typename T>
-    shared_ptr<T[N]> make_shared(T&& value);
+    template<typename U> // U = T[N]
+    shared_ptr<U> make_shared(T&& value);
 
-    template<typename T, typename A>
-    shared_ptr<T[]> allocate_shared(const A& allocator, size_t size, T&& value);
+    template<typename U, typename A> // U = T[]
+    shared_ptr<U> allocate_shared(const A& allocator, size_t size, T&& value);
 
-    template<typename T, typename A>
-    shared_ptr<T[N]> allocate_shared(const A& allocator, T&& value);    
+    template<typename U, typename A> // U = T[N]
+    shared_ptr<U> allocate_shared(const A& allocator, T&& value);
 #endif
 #endif
 
-    template<typename T>
-    shared_ptr<T[]> make_shared_noinit(size_t size);
+    template<typename U> // U = T[]
+    shared_ptr<U> make_shared_noinit(size_t size);
 
-    template<typename T>
-    shared_ptr<T[N]> make_shared_noinit();
-    
-    template<typename T, typename A>
-    shared_ptr<T[]> allocate_shared_noinit(const A& allocator, size_t size);
+    template<typename U> // U = T[N]
+    shared_ptr<U> make_shared_noinit();
 
-    template<typename T, typename A>
-    shared_ptr<T[N]> allocate_shared_noinit(const A& allocator);
+    template<typename U, typename A> // U = T[]
+    shared_ptr<U> allocate_shared_noinit(const A& allocator, size_t size);
+
+    template<typename U, typename A> // U = T[N]
+    shared_ptr<U> allocate_shared_noinit(const A& allocator);
 }

Free Functions

-
template<typename T, typename... Args>
-    shared_ptr<T[]> make_shared(size_t size, Args&&... args);
-template<typename T, typename A, typename... Args>
-    shared_ptr<T[]> allocate_shared(const A& allocator, size_t size, Args&&... args);
+
template<typename U, typename... Args>
+    shared_ptr<U> make_shared(size_t size, Args&&... args);
+template<typename U, typename A, typename... Args>
+    shared_ptr<U> allocate_shared(const A& allocator, size_t size, Args&&... args);

Requires: The expression new(pointer) T(forward<Args>(args)...), where @@ -121,7 +121,7 @@ template<typename T, typename A, typename... Args> T and size size and constructs an array of objects in it via the placement new expression new(pointer) T() or - new(pointer) T(forward<Args>(args)...). + new(pointer) T(args...). allocate_shared uses a copy of allocator to allocate memory. If an exception is thrown, has no effect.

@@ -146,74 +146,74 @@ template<typename T, typename A, typename... Args> take any constructor arguments. These overloads invoke the default constructor of T for each array element.

-
template<typename T, typename... Args>
-    shared_ptr<T[N]> make_shared(Args&&... args);
-template<typename T, typename A, typename... Args>
-    shared_ptr<T[N]> allocate_shared(const A& allocator, Args&&... args);
+
template<typename U, typename... Args>
+    shared_ptr<U> make_shared(Args&&... args);
+template<typename U, typename A, typename... Args>
+    shared_ptr<U> allocate_shared(const A& allocator, Args&&... args);

Description: These overloads of the utilities above are for a fixed size array.

-
template<typename T, typename... Args>
-    shared_ptr<T[]> make_shared(initializer_list<T> list);
-template<typename T, typename A, typename... Args>
-    shared_ptr<T[]> allocate_shared(const A& allocator, initializer_list<T> list);
+
template<typename U, typename... Args>
+    shared_ptr<U> make_shared(initializer_list<T> list);
+template<typename U, typename A, typename... Args>
+    shared_ptr<U> allocate_shared(const A& allocator, initializer_list<T> list);

Description: These overloads initialize the array elements from the initializer list.

-
template<typename T, typename... Args>
-    shared_ptr<T[N]> make_shared(const T (&list)[N]);
-template<typename T, typename A, typename... Args>
-    shared_ptr<T[N]> allocate_shared(const A& allocator, const T (&list)[N]);
+
template<typename U, typename... Args>
+    shared_ptr<U> make_shared(const T (&list)[N]);
+template<typename U, typename A, typename... Args>
+    shared_ptr<U> allocate_shared(const A& allocator, const T (&list)[N]);

Description: These overloads of the utilities above are for a fixed size array.

-
template<typename T, typename... Args>
-    shared_ptr<T[][N]> make_shared(size_t size, const T (&list)[N]);
-template<typename T, typename A, typename... Args>
-    shared_ptr<T[][N]> allocate_shared(const A& allocator, size_t size, const T (&list)[N]);
+
template<typename U, typename... Args>
+    shared_ptr<U> make_shared(size_t size, const T (&list)[N]);
+template<typename U, typename A, typename... Args>
+    shared_ptr<U> allocate_shared(const A& allocator, size_t size, const T (&list)[N]);

Description: These overloads initialize inner array elements from the initializer list.

-
template<typename T, typename... Args>
-    shared_ptr<T[M][N]> make_shared(const T (&list)[N]);
-template<typename T, typename A, typename... Args>
-    shared_ptr<T[M][N]> allocate_shared(const A& allocator, const T (&list)[N]);
+
template<typename U, typename... Args> // U = T[M][N]
+    shared_ptr<U> make_shared(const T (&list)[N]);
+template<typename U, typename A, typename... Args> // U = T[M][N]
+    shared_ptr<U> allocate_shared(const A& allocator, const T (&list)[N]);

Description: These overloads of the utilities above are for a fixed size array.

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

Description: These overloads initialize array elements with the given value.

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

Description: These overloads of the utilities above are for a fixed size array.

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

Description: These overloads do not perform any value initialization of elements.

-
template<typename T>
-    shared_ptr<T[N]> make_shared_noinit();
-template<typename T, typename A>
-    shared_ptr<T[N]> allocate_shared_noinit(const A& allocator);
+
template<typename U>
+    shared_ptr<U> make_shared_noinit();
+template<typename U, typename A>
+    shared_ptr<U> allocate_shared_noinit(const A& allocator);

Description: These overloads of the utilities above are for a fixed size array.

@@ -221,7 +221,7 @@ template<typename T, typename A>

Example

An example of each overload of make_shared for arrays:

-
boost::shared_ptr<point[]> a1 = boost::make_shared<point[]>(size);
+    
boost::shared_ptr<int[]> a1 = boost::make_shared<int[]>(size);
 boost::shared_ptr<point[]> a2 = boost::make_shared<point[]>(size, x, y);
 boost::shared_ptr<point[5]> a3 = boost::make_shared<point[5]>(x, y);
 boost::shared_ptr<int[]> a4 = boost::make_shared<int[]>({1, 2, 3});