diff --git a/doc/smart_ptr.adoc b/doc/smart_ptr.adoc index 3c299c3..2c1a7cc 100644 --- a/doc/smart_ptr.adoc +++ b/doc/smart_ptr.adoc @@ -39,6 +39,8 @@ include::smart_ptr/intrusive_ref_counter.adoc[] include::smart_ptr/local_shared_ptr.adoc[] +include::smart_ptr/make_local_shared.adoc[] + include::smart_ptr/pointer_cast.adoc[] include::smart_ptr/pointer_to_other.adoc[] diff --git a/doc/smart_ptr/make_local_shared.adoc b/doc/smart_ptr/make_local_shared.adoc new file mode 100644 index 0000000..3d586f7 --- /dev/null +++ b/doc/smart_ptr/make_local_shared.adoc @@ -0,0 +1,81 @@ +//// +Copyright 2017 Glen Joseph Fernandes (glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. + +See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt +//// + +[#make_local_shared] +# make_local_shared: Creating local_shared_ptr +:toc: +:toc-title: +:idprefix: make_local_shared_ + +## Description + +The function templates `make_local_shared` and `allocate_local_shared` provide +convenient, safe and efficient ways to create `local_shared_ptr` objects. They +are analogous to `make_shared` and `allocate_shared` for `shared_ptr`. + +## Synopsis + +`make_local_shared` and `allocate_local_shared` are defined in +``. + +[subs=+quotes] +``` +namespace boost { + `// only if T is not an array type` + template + local_shared_ptr make_local_shared(Args&&... args); + template + local_shared_ptr allocate_local_shared(const A& a, Args&&... args); + + `// only if T is an array type of the form U[]` + template + local_shared_ptr make_local_shared(std::size_t n); + template + local_shared_ptr allocate_local_shared(const A& a, std::size_t n); + + `// only if T is an array type of the form U[N]` + template + local_shared_ptr make_local_shared(); + template + local_shared_ptr allocate_local_shared(const A& a); + + `// only if T is an array type of the form U[]` + template + local_shared_ptr make_local_shared(std::size_t n, + const remove_extent_t& v); + template + local_shared_ptr allocate_local_shared(const A& a, std::size_t n, + const remove_extent_t& v); + + `// only if T is an array type of the form U[N]` + template + local_shared_ptr make_local_shared(const remove_extent_t& v); + template + local_shared_ptr allocate_local_shared(const A& a, + const remove_extent_t& v); + + `// only if T is not an array type of the form U[]` + template + local_shared_ptr make_local_shared_noinit(); + template + local_shared_ptr allocate_local_shared_noinit(const A& a); + + `// only if T is an array type of the form U[N]` + template + local_shared_ptr make_local_shared_noinit(std::size_t n); + template + local_shared_ptr allocate_local_shared_noinit(const A& a, + std::size_t n); +} +``` + +## Description + +The requirements and effects of these functions are the same as `make_shared` +and `allocate_shared`, except that a `local_shared_ptr` is returned.