Quick Links: |
#include <bslma_managedptr.h>
Static Public Member Functions | |
static void | noOpDeleter (void *, void *) |
template<class ELEMENT_TYPE , class... ARGS> | |
static ManagedPtr< ELEMENT_TYPE > | allocateManaged (bslma::Allocator *basicAllocator, ARGS &&...args) |
template<class ELEMENT_TYPE , class... ARGS> | |
static ManagedPtr< ELEMENT_TYPE > | makeManaged (ARGS &&...args) |
This utility class provides a general no-op deleter, which is useful when creating managed pointers to stack-allocated objects.
See Component bslma_managedptr
static void bslma::ManagedPtrUtil::noOpDeleter | ( | void * | , | |
void * | ||||
) | [static] |
Deleter function that does nothing.
static ManagedPtr<ELEMENT_TYPE> bslma::ManagedPtrUtil::allocateManaged | ( | bslma::Allocator * | basicAllocator, | |
ARGS &&... | args | |||
) | [static] |
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 basicAllocator
to supply memory for the footprint of the new object and implicitly pass basicAllocator
as the last argument of its constructor if bslma::UsesBslmaAllocator<ELEMENT_TYPE>value
is true
. If basicAllocator
is 0, the currently installed default allocator is used.
static ManagedPtr<ELEMENT_TYPE> bslma::ManagedPtrUtil::makeManaged | ( | ARGS &&... | args | ) | [static] |
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 currently installed default allocator to supply memory for the footprint of the new object but do not implicitly pass the default allocator as the last argument of its constructor even if bslma::UsesBslmaAllocator<ELEMENT_TYPE>value
is true
. Note that an allocator may be included in args
but see allocateManaged
for an alternative function that is better suited to creating managed pointers to objects of allocator-aware type.