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.

Synopsis

Declared in <bslstl_sharedptr.h>

template<
    class ELEMENT_TYPE,
    class ALLOC,
    class... ARGS>
bsl::shared_ptr<ELEMENT_TYPE>
allocate_shared(
    ALLOC* basicAllocator,
    ARGS&&... args)
requires !is_array<ELEMENT_TYPE>::value;

Created with MrDocs