Create and return a ManagedPtr to a new ELEMENT_TYPE object.
Declared in <bslma_managedptr.h>
template<
class ELEMENT_TYPE,
class... ARGS>
static
ManagedPtr<ELEMENT_TYPE>
allocateManaged(
bslma::Allocator* allocator,
ARGS&&... args);
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<>.
ManagedPtr managing the newly created ELEMENT_TYPE object
| Name | Description |
|---|---|
| allocator | allocator used to supply memory for the new object |
| args | arguments forwarded to the ELEMENT_TYPE constructor |