1//// 2Copyright 2017 Glen Joseph Fernandes (glenjofe@gmail.com) 3 4Distributed under the Boost Software License, Version 1.0. 5 6See accompanying file LICENSE_1_0.txt or copy at 7http://www.boost.org/LICENSE_1_0.txt 8//// 9 10[#make_local_shared] 11# make_local_shared: Creating local_shared_ptr 12:toc: 13:toc-title: 14:idprefix: make_local_shared_ 15 16## Description 17 18The function templates `make_local_shared` and `allocate_local_shared` provide 19convenient, safe and efficient ways to create `local_shared_ptr` objects. They 20are analogous to `make_shared` and `allocate_shared` for `shared_ptr`. 21 22## Synopsis 23 24`make_local_shared` and `allocate_local_shared` are defined in 25`<boost/smart_ptr/make_local_shared.hpp>`. 26 27[subs=+quotes] 28``` 29namespace boost { 30 `// T is not an array` 31 template<class T, class... Args> 32 local_shared_ptr<T> make_local_shared(Args&&... args); 33 template<class T, class A, class... Args> 34 local_shared_ptr<T> allocate_local_shared(const A& a, Args&&... args); 35 36 `// T is an array of unknown bounds` 37 template<class T> 38 local_shared_ptr<T> make_local_shared(std::size_t n); 39 template<class T, class A> 40 local_shared_ptr<T> allocate_local_shared(const A& a, std::size_t n); 41 42 `// T is an array of known bounds` 43 template<class T> 44 local_shared_ptr<T> make_local_shared(); 45 template<class T, class A> 46 local_shared_ptr<T> allocate_local_shared(const A& a); 47 48 `// T is an array of unknown bounds` 49 template<class T> 50 local_shared_ptr<T> make_local_shared(std::size_t n, 51 const remove_extent_t<T>& v); 52 template<class T, class A> 53 local_shared_ptr<T> allocate_local_shared(const A& a, std::size_t n, 54 const remove_extent_t<T>& v); 55 56 `// T is an array of known bounds` 57 template<class T> 58 local_shared_ptr<T> make_local_shared(const remove_extent_t<T>& v); 59 template<class T, class A> 60 local_shared_ptr<T> allocate_local_shared(const A& a, 61 const remove_extent_t<T>& v); 62 63 `// T is not an array of known bounds` 64 template<class T> 65 local_shared_ptr<T> make_local_shared_noinit(); 66 template<class T, class A> 67 local_shared_ptr<T> allocate_local_shared_noinit(const A& a); 68 69 `// T is an array of unknown bounds` 70 template<class T> 71 local_shared_ptr<T> make_local_shared_noinit(std::size_t n); 72 template<class T, class A> 73 local_shared_ptr<T> allocate_local_shared_noinit(const A& a, 74 std::size_t n); 75} 76``` 77 78## Description 79 80The requirements and effects of these functions are the same as `make_shared` 81and `allocate_shared`, except that a `local_shared_ptr` is returned. 82