Create and return a ManagedPtr to a new ELEMENT_TYPE object.
Synopsis
Declared in <bslma_managedptr.h>
template<
class ELEMENT_TYPE,
class... ARGS>
static
ManagedPtr<ELEMENT_TYPE>
allocateManaged(
bslma::Allocator* allocator,
ARGS&&... args);
Description
Create an object of the (template parameter) ELEMENT_TYPE from the specified args... arguments, and return a ManagedPtr to manage the new object. Use the specified allocator to supply memory for the footprint of the new object and implicitly pass allocator as the allocator argument to the ELEMENT_TYPE constructor if bslma::UsesBslmaAllocator<ELEMENT_TYPE>::value is true. If allocator is a null pointer, the currently installed default allocator is used. Note that compilation will fail unless allocator is convertible to either bslma::Allocator * or bsl::allocator<>.
Return Value
ManagedPtr managing the newly created ELEMENT_TYPE object
Parameters
Name |
Description |
allocator |
allocator used to supply memory for the new object |
args |
arguments forwarded to the |
Created with MrDocs