[#bsl-allocate_shared-0be] = xref:bsl.adoc[bsl]::allocate_shared :relfileprefix: ../ :mrdocs: `allocate_shared` overloads == Synopses Declared in `<bslstl_sharedptr.h>` Return a `shared_ptr` object referring to and managing a new `ARRAY_TYPE` object, where `ARRAY_TYPE` is a bounded array. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ARRAY_TYPE` object, and each element in the array is default constructed. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ARRAY_TYPE, class ALLOC> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ARRAY_TYPE>] xref:bsl/allocate_shared-0f.adoc[allocate_shared](ALLOC basicAllocator) requires is_bounded_array<ARRAY_TYPE>::value && !is_pointer<ALLOC>::value; ---- [.small]#xref:bsl/allocate_shared-0f.adoc[_» more..._]# Return a `shared_ptr` object referring to and managing a new `ARRAY_TYPE` object, where `ARRAY_TYPE` is a bounded array. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ARRAY_TYPE` object, and each element in the array is default constructed. If `basicAllocator` is 0, then the default allocator will be used instead. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ARRAY_TYPE, class ALLOC> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ARRAY_TYPE>] xref:bsl/allocate_shared-08.adoc[allocate_shared](ALLOC* basicAllocator) requires is_bounded_array<ARRAY_TYPE>::value; ---- [.small]#xref:bsl/allocate_shared-08.adoc[_» more..._]# Return a `shared_ptr` object referring to and managing a new `ARRAY_TYPE` object, where `ARRAY_TYPE` is a unbounded array. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ARRAY_TYPE` containing the specified `numElements` number of elements, and each element in the array is default constructed. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ARRAY_TYPE, class ALLOC> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ARRAY_TYPE>] xref:bsl/allocate_shared-07.adoc[allocate_shared]( ALLOC basicAllocator, std::size_t numElements) requires is_unbounded_array<ARRAY_TYPE>::value && !is_pointer<ALLOC>::value; ---- [.small]#xref:bsl/allocate_shared-07.adoc[_» more..._]# Return a `shared_ptr` object referring to and managing a new `ARRAY_TYPE` object, where `ARRAY_TYPE` is a bounded array. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ARRAY_TYPE` object, and each element in the array is constructed from the specified `value`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ARRAY_TYPE, class ALLOC> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ARRAY_TYPE>] xref:bsl/allocate_shared-05d.adoc[allocate_shared]( ALLOC basicAllocator, remove_extent<ARRAY_TYPE>::type const& value) requires is_bounded_array<ARRAY_TYPE>::value && !is_pointer<ALLOC>::value; ---- [.small]#xref:bsl/allocate_shared-05d.adoc[_» more..._]# Return a `shared_ptr` object referring to and managing a new `ARRAY_TYPE` object, where `ARRAY_TYPE` is a unbounded array. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ARRAY_TYPE` containing the specified `numElements` number of elements, and each element in the array is default constructed. If `basicAllocator` is 0, then the default allocator will be used instead. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ARRAY_TYPE, class ALLOC> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ARRAY_TYPE>] xref:bsl/allocate_shared-05b.adoc[allocate_shared]( ALLOC* basicAllocator, std::size_t numElements) requires is_unbounded_array<ARRAY_TYPE>::value; ---- [.small]#xref:bsl/allocate_shared-05b.adoc[_» more..._]# Return a `shared_ptr` object referring to and managing a new `ARRAY_TYPE` object, where `ARRAY_TYPE` is a bounded array. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ARRAY_TYPE` object, and each element in the array is constructed from the specified `value`. If `basicAllocator` is 0, then the default allocator will be used instead. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ARRAY_TYPE, class ALLOC> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ARRAY_TYPE>] xref:bsl/allocate_shared-0c.adoc[allocate_shared]( ALLOC* basicAllocator, remove_extent<ARRAY_TYPE>::type const& value) requires is_bounded_array<ARRAY_TYPE>::value; ---- [.small]#xref:bsl/allocate_shared-0c.adoc[_» more..._]# Return a `shared_ptr` object referring to and managing a new `ELEMENT_TYPE` object. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ELEMENT_TYPE` object, which is initialized by calling `allocator_traits<ALLOC>::construct` passing `basicAllocator`, an `ELEMENT_TYPE *` pointer to space for the new shared object, and the specified arguments `std::forward<ARGS>(args)...`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ELEMENT_TYPE, class ALLOC, class... ARGS> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ELEMENT_TYPE>] xref:bsl/allocate_shared-01e.adoc[allocate_shared]( ALLOC basicAllocator, ARGS&&... args) requires !is_array<ELEMENT_TYPE>::value && !is_pointer<ALLOC>::value; ---- [.small]#xref:bsl/allocate_shared-01e.adoc[_» more..._]# Return a `shared_ptr` object referring to and managing a new `ELEMENT_TYPE` object. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ELEMENT_TYPE` object, which is initialized using the `ELEMENT_TYPE` constructor that takes the specified arguments `std::forward<ARGS>(args)...`. If `ELEMENT_TYPE` uses `bslma` allocators, then `basicAllocator` is passed as an extra argument in the final position. If `basicAllocator` is 0, then the default allocator will be used instead, and passed as the allocator, when appropriate, to the `ELEMENT_TYPE` constructor. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ELEMENT_TYPE, class ALLOC, class... ARGS> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ELEMENT_TYPE>] xref:bsl/allocate_shared-0bb.adoc[allocate_shared]( ALLOC* basicAllocator, ARGS&&... args) requires !is_array<ELEMENT_TYPE>::value; ---- [.small]#xref:bsl/allocate_shared-0bb.adoc[_» more..._]# Return a `shared_ptr` object referring to and managing a new `ARRAY_TYPE` object, where `ARRAY_TYPE` is a unbounded array. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ARRAY_TYPE` containing the specified `numElements` number of elements, and each element in the array is constructed from the specified `value`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ARRAY_TYPE, class ALLOC> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ARRAY_TYPE>] xref:bsl/allocate_shared-01f.adoc[allocate_shared]( ALLOC basicAllocator, std::size_t numElements, remove_extent<ARRAY_TYPE>::type const& value) requires is_unbounded_array<ARRAY_TYPE>::value && !is_pointer<ALLOC>::value; ---- [.small]#xref:bsl/allocate_shared-01f.adoc[_» more..._]# Return a `shared_ptr` object referring to and managing a new `ARRAY_TYPE` object, where `ARRAY_TYPE` is a unbounded array. The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer's internal representation and the new `ARRAY_TYPE` containing the specified `numElements` number of elements, and each element in the array is constructed from the specified `value`. If `basicAllocator` is 0, then the default allocator will be used instead. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ARRAY_TYPE, class ALLOC> xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<ARRAY_TYPE>] xref:bsl/allocate_shared-04.adoc[allocate_shared]( ALLOC* basicAllocator, std::size_t numElements, remove_extent<ARRAY_TYPE>::type const& value) requires is_unbounded_array<ARRAY_TYPE>::value; ---- [.small]#xref:bsl/allocate_shared-04.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#