Add examples to make_shared documentation

This commit is contained in:
Glen Fernandes
2017-06-14 01:20:58 -04:00
parent 8f99919102
commit bdcab9df47

View File

@@ -175,6 +175,9 @@ Remarks::: These overloads shall only participate in overload resolution when
`T` is not an array type.
Returns::: A `shared_ptr` to an object of type `T`, constructed from
`args$$...$$`.
Examples:::
* `auto p = make_shared<int>();`
* `auto p = make_shared<std::vector<int> >(16, 1);`
```
template<class T>
@@ -190,6 +193,9 @@ Remarks::: These overloads shall only participate in overload resolution when
`T` is an array type of the form `__U__[]`.
Returns::: A `shared_ptr` to a sequence of `n` value-initialized objects of
type `_U_`.
Examples:::
* `auto p = make_shared<double[]>(1024);`
* `auto p = make_shared<double[][2][2]>(6);`
```
template<class T>
@@ -205,6 +211,9 @@ Remarks::: These overloads shall only participate in overload resolution when
`T` is an array type of the form `__U__[__N__]`.
Returns::: A `shared_ptr` to a sequence of `_N_` value-initialized objects of
type `_U_`.
Examples:::
* `auto p = make_shared<double[1024]>();`
* `auto p = make_shared<double[6][2][2]>();`
[subs=+quotes]
```
@@ -222,6 +231,10 @@ Remarks::: These overloads shall only participate in overload resolution when
`T` is an array type of the form `__U__[]`.
Returns::: A `shared_ptr` to a sequence of `n` objects of type `_U_`, each
initialized to `v`.
Examples:::
* `auto p = make_shared<double[]>(1024, 1.0);`
* `auto p = make_shared<double[][2]>(6, {1.0, 0.0});`
* `auto p = make_shared<std::vector<int>[]>(4, {1, 2});`
[subs=+quotes]
```
@@ -239,6 +252,10 @@ Remarks::: These overloads shall only participate in overload resolution when
`T` is an array type of the form `__U__[__N__]`.
Returns::: A `shared_ptr` to a sequence of `_N_` objects of type `_U_`, each
initialized to `v`.
Examples:::
* `auto p = make_shared<double[1024]>(1.0);`
* `auto p = make_shared<double[6][2]>({1.0, 0.0});`
* `auto p = make_shared<std::vector<int>[4]>({1, 2});`
```
template<class T>
@@ -254,6 +271,10 @@ Remarks::: These overloads shall only participate in overload resolution when
`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
sequence of `_N_` default-initialized objects of type `_U_`, respectively.
Examples:::
* `struct X { double data[1024]; }; +
auto p = make_shared_noinit<X>();`
* `auto p = make_shared_noinit<double[1024]>();`
```
template<class T>
@@ -269,3 +290,4 @@ Remarks::: These overloads shall only participate in overload resolution when
`T` is an array type of the form `__U__[]`.
Returns::: A `shared_ptr` to a sequence of `_n_` default-initialized objects
of type `_U_`.
Example::: `auto p = make_shared_noinit<double[]>(1024);`