Update constraints and synopsis in documentation

This commit is contained in:
Glen Fernandes
2019-09-02 21:58:29 -04:00
parent f788448101
commit a6323354cd
5 changed files with 10975 additions and 70 deletions

10918
doc/smart_ptr.html Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -124,8 +124,8 @@ value `v`, or constructed from `args\...`, `allocate_unique` shall perform this
initialization via the expression initialization via the expression
`std::allocator_traits<A2>::construct(a2, p, expr)` (where `_expr_` is `v` or `std::allocator_traits<A2>::construct(a2, p, expr)` (where `_expr_` is `v` or
`std::forward<Args>(args)\...)` respectively), `p` points to storage suitable `std::forward<Args>(args)\...)` respectively), `p` points to storage suitable
to hold an object of type `U`, and `a2` of type `A2` is a rebound copy `a` such to hold an object of type `U`, and `a2` of type `A2` is a potentially rebound
that its `value_type` is `U`. copy of `a`.
* When a (sub)object of non-array type `U` is specified to be * When a (sub)object of non-array type `U` is specified to be
default-initialized, `allocate_unique_noinit` shall perform this initialization default-initialized, `allocate_unique_noinit` shall perform this initialization
via the expression `::new(p) U`, where `p` has type `void*` and points to via the expression `::new(p) U`, where `p` has type `void*` and points to
@@ -134,7 +134,7 @@ storage suitable to hold an object of type `U`.
value-initialized, `allocate_unique` shall perform this initialization via the value-initialized, `allocate_unique` shall perform this initialization via the
expression `std::allocator_traits<A2>::construct(a2, p)`, where `p` points to expression `std::allocator_traits<A2>::construct(a2, p)`, where `p` points to
storage suitable to hold an object of type `U` and `a2` of type `A2` is a storage suitable to hold an object of type `U` and `a2` of type `A2` is a
rebound copy of `a` such that its value_type is `U`. potentially rebound copy of `a`.
* Array elements are initialized in ascending order of their addresses. * Array elements are initialized in ascending order of their addresses.
* When the lifetime of the object managed by the return value ends, or when the * When the lifetime of the object managed by the return value ends, or when the
initialization of an array element throws an exception, the initialized initialization of an array element throws an exception, the initialized
@@ -278,7 +278,6 @@ functions.
[subs=+quotes] [subs=+quotes]
``` ```
namespace boost {
template<class T, class A> template<class T, class A>
class alloc_deleter { class alloc_deleter {
public: public:
@@ -288,7 +287,6 @@ namespace boost {
void operator()(pointer p); void operator()(pointer p);
}; };
}
``` ```
### Members ### Members

View File

@@ -27,25 +27,25 @@ are analogous to `make_shared` and `allocate_shared` for `shared_ptr`.
[subs=+quotes] [subs=+quotes]
``` ```
namespace boost { namespace boost {
`// only if T is not an array type` `// T is not an array`
template<class T, class... Args> template<class T, class... Args>
local_shared_ptr<T> make_local_shared(Args&&... args); local_shared_ptr<T> make_local_shared(Args&&... args);
template<class T, class A, class... Args> template<class T, class A, class... Args>
local_shared_ptr<T> allocate_local_shared(const A& a, Args&&... args); local_shared_ptr<T> allocate_local_shared(const A& a, Args&&... args);
`// only if T is an array type of the form U[]` `// T is an array of unknown bounds`
template<class T> template<class T>
local_shared_ptr<T> make_local_shared(std::size_t n); local_shared_ptr<T> make_local_shared(std::size_t n);
template<class T, class A> template<class T, class A>
local_shared_ptr<T> allocate_local_shared(const A& a, std::size_t n); local_shared_ptr<T> allocate_local_shared(const A& a, std::size_t n);
`// only if T is an array type of the form U[N]` `// T is an array of known bounds`
template<class T> template<class T>
local_shared_ptr<T> make_local_shared(); local_shared_ptr<T> make_local_shared();
template<class T, class A> template<class T, class A>
local_shared_ptr<T> allocate_local_shared(const A& a); local_shared_ptr<T> allocate_local_shared(const A& a);
`// only if T is an array type of the form U[]` `// T is an array of unknown bounds`
template<class T> template<class T>
local_shared_ptr<T> make_local_shared(std::size_t n, local_shared_ptr<T> make_local_shared(std::size_t n,
const remove_extent_t<T>& v); const remove_extent_t<T>& v);
@@ -53,20 +53,20 @@ namespace boost {
local_shared_ptr<T> allocate_local_shared(const A& a, std::size_t n, local_shared_ptr<T> allocate_local_shared(const A& a, std::size_t n,
const remove_extent_t<T>& v); const remove_extent_t<T>& v);
`// only if T is an array type of the form U[N]` `// T is an array of known bounds`
template<class T> template<class T>
local_shared_ptr<T> make_local_shared(const remove_extent_t<T>& v); local_shared_ptr<T> make_local_shared(const remove_extent_t<T>& v);
template<class T, class A> template<class T, class A>
local_shared_ptr<T> allocate_local_shared(const A& a, local_shared_ptr<T> allocate_local_shared(const A& a,
const remove_extent_t<T>& v); const remove_extent_t<T>& v);
`// only if T is not an array type of the form U[]` `// T is not an array of known bounds`
template<class T> template<class T>
local_shared_ptr<T> make_local_shared_noinit(); local_shared_ptr<T> make_local_shared_noinit();
template<class T, class A> template<class T, class A>
local_shared_ptr<T> allocate_local_shared_noinit(const A& a); local_shared_ptr<T> allocate_local_shared_noinit(const A& a);
`// only if T is an array type of the form U[N]` `// T is an array of unknown bounds`
template<class T> template<class T>
local_shared_ptr<T> make_local_shared_noinit(std::size_t n); local_shared_ptr<T> make_local_shared_noinit(std::size_t n);
template<class T, class A> template<class T, class A>

View File

@@ -55,43 +55,43 @@ types.
[subs=+quotes] [subs=+quotes]
``` ```
namespace boost { namespace boost {
`// only if T is not an array type` `// T is not an array`
template<class T, class... Args> template<class T, class... Args>
shared_ptr<T> make_shared(Args&&... args); shared_ptr<T> make_shared(Args&&... args);
template<class T, class A, class... Args> template<class T, class A, class... Args>
shared_ptr<T> allocate_shared(const A& a, Args&&... args); shared_ptr<T> allocate_shared(const A& a, Args&&... args);
`// only if T is an array type of the form U[]` `// T is an array of unknown bounds`
template<class T> template<class T>
shared_ptr<T> make_shared(std::size_t n); shared_ptr<T> make_shared(std::size_t n);
template<class T, class A> template<class T, class A>
shared_ptr<T> allocate_shared(const A& a, std::size_t n); shared_ptr<T> allocate_shared(const A& a, std::size_t n);
`// only if T is an array type of the form U[N]` `// T is an array of known bounds`
template<class T> template<class T>
shared_ptr<T> make_shared(); shared_ptr<T> make_shared();
template<class T, class A> template<class T, class A>
shared_ptr<T> allocate_shared(const A& a); shared_ptr<T> allocate_shared(const A& a);
`// only if T is an array type of the form U[]` `// T is an array of unknown bounds`
template<class T> shared_ptr<T> template<class T> shared_ptr<T>
make_shared(std::size_t n, const remove_extent_t<T>& v); make_shared(std::size_t n, const remove_extent_t<T>& v);
template<class T, class A> shared_ptr<T> template<class T, class A> shared_ptr<T>
allocate_shared(const A& a, std::size_t n, const remove_extent_t<T>& v); allocate_shared(const A& a, std::size_t n, const remove_extent_t<T>& v);
`// only if T is an array type of the form U[N]` `// T is an array of known bounds`
template<class T> template<class T>
shared_ptr<T> make_shared(const remove_extent_t<T>& v); shared_ptr<T> make_shared(const remove_extent_t<T>& v);
template<class T, class A> template<class T, class A>
shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& v); shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& v);
`// only if T is not an array type of the form U[]` `// T is not an array of unknown bounds`
template<class T> template<class T>
shared_ptr<T> make_shared_noinit(); shared_ptr<T> make_shared_noinit();
template<class T, class A> template<class T, class A>
shared_ptr<T> allocate_shared_noinit(const A& a); shared_ptr<T> allocate_shared_noinit(const A& a);
`// only if T is an array type of the form U[N]` `// T is an array of unknown bounds`
template<class T> template<class T>
shared_ptr<T> make_shared_noinit(std::size_t n); shared_ptr<T> make_shared_noinit(std::size_t n);
template<class T, class A> template<class T, class A>
@@ -144,7 +144,7 @@ perform this initialization via the expression
`std::allocator_traits<A2>::construct(a2, p, expr)` (where `std::allocator_traits<A2>::construct(a2, p, expr)` (where
`_expr_` is `v` or `std::forward<Args>(args)\...)` respectively), `p` `_expr_` is `v` or `std::forward<Args>(args)\...)` respectively), `p`
points to storage suitable to hold an object of type `U`, and `a2` of points to storage suitable to hold an object of type `U`, and `a2` of
type `A2` is a rebound copy `a` such that its `value_type` is `U`. type `A2` is a potentially rebound copy `a`.
* When a (sub)object of non-array type `U` is specified to be * When a (sub)object of non-array type `U` is specified to be
default-initialized, `make_shared_noinit` and `allocate_shared_noinit` shall default-initialized, `make_shared_noinit` and `allocate_shared_noinit` shall
perform this initialization via the expression `::new(p) U`, where perform this initialization via the expression `::new(p) U`, where
@@ -158,7 +158,7 @@ storage suitable to hold an object of type `U`.
value-initialized, `allocate_shared` shall perform this initialization via the value-initialized, `allocate_shared` shall perform this initialization via the
expression `std::allocator_traits<A2>::construct(a2, p)`, where expression `std::allocator_traits<A2>::construct(a2, p)`, where
`p` points to storage suitable to hold an object of type `U` and `a2` of `p` points to storage suitable to hold an object of type `U` and `a2` of
type `A2` is a rebound copy of `a` such that its value_type is `U`. type `A2` is a potentially rebound copy of `a`.
* Array elements are initialized in ascending order of their addresses. * Array elements are initialized in ascending order of their addresses.
* When the lifetime of the object managed by the return value ends, or when * When the lifetime of the object managed by the return value ends, or when
the initialization of an array element throws an exception, the initialized the initialization of an array element throws an exception, the initialized
@@ -181,8 +181,7 @@ template<class T, class A, class... Args>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is not an array.
`T` is not an array type.
Returns:: A `shared_ptr` to an object of type `T`, constructed from Returns:: A `shared_ptr` to an object of type `T`, constructed from
`args\...`. `args\...`.
Examples:: Examples::
@@ -200,10 +199,9 @@ template<class T, class A>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is an array of unknown bounds.
`T` is an array type of the form `U[]`.
Returns:: A `shared_ptr` to a sequence of `n` value-initialized objects of Returns:: A `shared_ptr` to a sequence of `n` value-initialized objects of
type `U`. type `remove_extent_t<T>`.
Examples:: Examples::
* `auto p = make_shared<double[]>(1024);` * `auto p = make_shared<double[]>(1024);`
* `auto p = make_shared<double[][2][2]>(6);` * `auto p = make_shared<double[][2][2]>(6);`
@@ -219,10 +217,9 @@ template<class T, class A>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is an array of known bounds.
`T` is an array type of the form `U[N]`. Returns:: A `shared_ptr` to a sequence of `extent_v<T>` value-initialized
Returns:: A `shared_ptr` to a sequence of `N` value-initialized objects of objects of type `remove_extent_t<T>`.
type `U`.
Examples:: Examples::
* `auto p = make_shared<double[1024]>();` * `auto p = make_shared<double[1024]>();`
* `auto p = make_shared<double[6][2][2]>();` * `auto p = make_shared<double[6][2][2]>();`
@@ -238,10 +235,9 @@ template<class T, class A> shared_ptr<T>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is an array of unknown bounds.
`T` is an array type of the form `U[]`. Returns:: A `shared_ptr` to a sequence of `n` objects of type
Returns:: A `shared_ptr` to a sequence of `n` objects of type `U`, each `remove_extent_t<T>`, each initialized to `v`.
initialized to `v`.
Examples:: Examples::
* `auto p = make_shared<double[]>(1024, 1.0);` * `auto p = make_shared<double[]>(1024, 1.0);`
* `auto p = make_shared<double[][2]>(6, {1.0, 0.0});` * `auto p = make_shared<double[][2]>(6, {1.0, 0.0});`
@@ -258,10 +254,9 @@ template<class T, class A>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is an array of known bounds.
`T` is an array type of the form `U[N]`. Returns:: A `shared_ptr` to a sequence of `extent_v<T>` objects of type
Returns:: A `shared_ptr` to a sequence of `N` objects of type `U`, each `remove_extent_t<T>`, each initialized to `v`.
initialized to `v`.
Examples:: Examples::
* `auto p = make_shared<double[1024]>(1.0);` * `auto p = make_shared<double[1024]>(1.0);`
* `auto p = make_shared<double[6][2]>({1.0, 0.0});` * `auto p = make_shared<double[6][2]>({1.0, 0.0});`
@@ -278,10 +273,10 @@ template<class T, class A>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is not an array, or is an array of known bounds.
`T` is not an array type, or an array type of the `U[N]`.
Returns:: A `shared_ptr` to a default-initialized object of type `T`, or a Returns:: A `shared_ptr` to a default-initialized object of type `T`, or a
sequence of `N` default-initialized objects of type `U`, respectively. sequence of `extent_v<T>` default-initialized objects of type
`remove_extent_t<T>`, respectively.
Example:: `auto p = make_shared_noinit<double[1024]>();` Example:: `auto p = make_shared_noinit<double[1024]>();`
``` ```
@@ -295,8 +290,7 @@ template<class T, class A>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is an array of unknown bounds.
`T` is an array type of the form `U[]`.
Returns:: A `shared_ptr` to a sequence of `_n_` default-initialized objects Returns:: A `shared_ptr` to a sequence of `_n_` default-initialized objects
of type `U`. of type `remove_extent_t<T>`.
Example:: `auto p = make_shared_noinit<double[]>(1024);` Example:: `auto p = make_shared_noinit<double[]>(1024);`

View File

@@ -40,23 +40,23 @@ feature with `std::make_unique`.
[subs=+quotes] [subs=+quotes]
``` ```
namespace boost { namespace boost {
`// only if T is not an array type` `// T is not an array`
template<class T, class... Args> template<class T, class... Args>
std::unique_ptr<T> make_unique(Args&&... args); std::unique_ptr<T> make_unique(Args&&... args);
`// only if T is not an array type` `// T is not an array`
template<class T> template<class T>
std::unique_ptr<T> make_unique(remove_reference_t<T>&& v); std::unique_ptr<T> make_unique(type_identity_t<T>&& v);
`// only if T is an array type of the form U[]` `// T is an array of unknown bounds`
template<class T> template<class T>
std::unique_ptr<T> make_unique(std::size_t n); std::unique_ptr<T> make_unique(std::size_t n);
`// only if T is not an array type` `// T is not an array`
template<class T> template<class T>
std::unique_ptr<T> make_unique_noinit(); std::unique_ptr<T> make_unique_noinit();
`// only if T is an array type of the form U[]` `// T is an array of unknown bounds`
template<class T> template<class T>
std::unique_ptr<T> make_unique_noinit(std::size_t n); std::unique_ptr<T> make_unique_noinit(std::size_t n);
} }
@@ -71,20 +71,18 @@ template<class T, class... Args>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is not an array.
`T` is not an array type.
Returns:: `std::unique_ptr<T>(new T(std::forward<Args>(args)\...)`. Returns:: `std::unique_ptr<T>(new T(std::forward<Args>(args)\...)`.
Example:: `auto p = make_unique<int>();` Example:: `auto p = make_unique<int>();`
``` ```
template<class T> template<class T>
std::unique_ptr<T> make_unique(remove_reference_t<T>&& v); std::unique_ptr<T> make_unique(type_identity_t<T>&& v);
``` ```
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is not an array.
`T` is not an array type.
Returns:: `std::unique_ptr<T>(new T(std::move(v))`. Returns:: `std::unique_ptr<T>(new T(std::move(v))`.
Example:: `auto p = make_unique<std::vector<int> >({1, 2});` Example:: `auto p = make_unique<std::vector<int> >({1, 2});`
@@ -95,9 +93,8 @@ template<class T>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is an array of unknown bounds.
`T` is an array type of the form `U[]`. Returns:: `std::unique_ptr<T>(new remove_extent_t<T>[n]())`.
Returns:: `std::unique_ptr<U[]>(new U[n]())`.
Example:: `auto p = make_unique<double[]>(1024);` Example:: `auto p = make_unique<double[]>(1024);`
``` ```
@@ -107,8 +104,7 @@ template<class T>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is not an array.
`T` is not an array type.
Returns:: `std::unique_ptr<T>(new T)`. Returns:: `std::unique_ptr<T>(new T)`.
Example:: `auto p = make_unique_noinit<double[1024]>();` Example:: `auto p = make_unique_noinit<double[1024]>();`
@@ -119,7 +115,6 @@ template<class T>
[none] [none]
* {blank} * {blank}
+ +
Remarks:: These overloads shall only participate in overload resolution when Constraints:: `T` is an array of unknown bounds.
`T` is an array type of the form `U[]`. Returns:: `std::unique_ptr<T>(new remove_extent_t<T>[n])`.
Returns:: `std::unique_ptr<U[]>(new U[n])`.
Example:: `auto p = make_unique_noinit<double[]>(1024);` Example:: `auto p = make_unique_noinit<double[]>(1024);`