[#BloombergLP-bslma-ManagedPtrUtil-allocateManaged-0f] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/ManagedPtrUtil.adoc[ManagedPtrUtil]::allocateManaged :relfileprefix: ../../../ :mrdocs: 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<>`. == Synopsis Declared in `<bslma_managedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class ELEMENT_TYPE, class... ARGS> static xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr<ELEMENT_TYPE>] allocateManaged( xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator, ARGS&&... args); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#