From bdcab9df474fde3f7bf7ae248881bb8be69e835a Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Wed, 14 Jun 2017 01:20:58 -0400 Subject: [PATCH] Add examples to make_shared documentation --- doc/smart_ptr/make_shared.adoc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/smart_ptr/make_shared.adoc b/doc/smart_ptr/make_shared.adoc index 22522e8..350b8b5 100644 --- a/doc/smart_ptr/make_shared.adoc +++ b/doc/smart_ptr/make_shared.adoc @@ -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();` +* `auto p = make_shared >(16, 1);` ``` template @@ -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(1024);` +* `auto p = make_shared(6);` ``` template @@ -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();` +* `auto p = make_shared();` [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(1024, 1.0);` +* `auto p = make_shared(6, {1.0, 0.0});` +* `auto p = make_shared[]>(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(1.0);` +* `auto p = make_shared({1.0, 0.0});` +* `auto p = make_shared[4]>({1, 2});` ``` template @@ -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();` +* `auto p = make_shared_noinit();` ``` template @@ -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(1024);` \ No newline at end of file