Destroy the currently managed object, if any. Then, set the target object of this managed pointer to be that referenced by the specified ptr, take ownership of *ptr as the currently managed object, and set a deleter that calls factory‐>deleteObject(ptr) to destroy the managed object when invoked (e.g., when this managed pointer object is destroyed), unless 0 == ptr, in which case reset this managed pointer to empty. The deleter will invoke the destructor of MANAGED_TYPE rather than the destructor of TARGET_TYPE. This function will not compile unless MANAGED_TYPE * is convertible to TARGET_TYPE *. The behavior is undefined unless the managed object (if any) can be destroyed by the specified factory, or if 0 == factory && 0 != ptr, or if the the lifetime of the managed object is already managed by another object. Note that bslma::Allocator, and any class publicly and unambiguously derived from bslma::Allocator, meets the requirements for FACTORY_TYPE.
Synopsis
Declared in <bslma_managedptr.h>
template<
class MANAGED_TYPE,
class FACTORY_TYPE>
void
load(
MANAGED_TYPE* ptr,
FACTORY_TYPE* factory);
Created with MrDocs