BloombergLP::bslma::ManagedPtr::load

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.

Synopsis

Declared in <bslma_managedptr.h>

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*));

Description

DEPRECATED: Instead, use: ` template <class MANAGED_TYPE> void load(MANAGED_TYPE *ptr, void *cookie, DeleterFunc deleter); `