load overloads
Declared in <bslma_managedptr.h>
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 uses the currently installed default allocator 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 currently installed default allocator, or if the lifetime of the managed object is already managed by another object.
template<class MANAGED_TYPE>
void
load(MANAGED_TYPE* ptr);
» more...
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.
template<
class MANAGED_TYPE,
class FACTORY_TYPE>
void
load(
MANAGED_TYPE* ptr,
FACTORY_TYPE* factory);
» more...
Destroy the current managed object (if any) and reset this managed pointer to empty. Note that the optionally specified cookie and deleter will be ignored, as empty managed pointers do not invoke a deleter.
void
load(
bsl::nullptr_t = 0,
void* cookie = 0,
DeleterFunc deleter = 0);
» more...
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 will invoke the specified deleter with the address of the currently managed object, and with the specified cookie (that the deleter can use for its own purposes), unless 0 == ptr, in which case reset this managed pointer to empty. The behavior is undefined if ptr is already managed by another object, or if 0 == deleter && 0 != ptr. Note that GCC 3.4 and earlier versions have a bug in template type deduction/overload resolution that causes ambiguities if this signature is available. This function will be restored on that platform once the deprecated signatures are finally removed.
template<class MANAGED_TYPE>
void
load(
MANAGED_TYPE* ptr,
void* cookie,
DeleterFunc deleter);
» more...
DEPRECATED: Use the non-template load overload instead.
template<
class MANAGED_TYPE,
class COOKIE_TYPE>
void
load(
MANAGED_TYPE* ptr,
COOKIE_TYPE* cookie,
DeleterFunc deleter);
» more...
DEPRECATED: Use the non-template load overload instead.
template<
class MANAGED_TYPE,
class MANAGED_BASE>
void
load(
MANAGED_TYPE* ptr,
void* cookie,
void(* deleter)(MANAGED_BASE*, void*));
» more...
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 will invoke the specified deleter with the address of the currently managed object, and with the specified cookie (that the deleter can use for its own purposes), unless 0 == ptr, in which case reset this managed pointer to empty. The behavior is undefined if ptr is already managed by another object, or if 0 == deleter && 0 != ptr. Note that this function is deprecated as it relies on undefined compiler behavior for its implementation, but luckily perform as required for all currently supported platforms; on platforms where the non-deprecated overload is not available (e.g., GCC 3.4) code should be written as if it were available, as an appropriate (deprecated) overload will be selected with the correct (non-deprecated) behavior.
template<
class MANAGED_TYPE,
class MANAGED_BASE,
class COOKIE_TYPE,
class COOKIE_BASE>
void
load(
MANAGED_TYPE* ptr,
COOKIE_TYPE* cookie,
void(* deleter)(MANAGED_BASE*, COOKIE_BASE*));
» more...