bsl::shared_ptr::load

Modify this shared pointer to manage the modifiable object of the (template parameter) type COMPATIBLE_TYPE at the specified ptr address and to refer to (ELEMENT_TYPE *)ptr. If this shared pointer is already managing a (possibly shared) object, then, unless an exception is thrown allocating memory to manage ptr, release the reference to the shared object, calling the associated deleter to destroy the shared object if this shared pointer is the last reference. Use the specified basicAllocator to allocate the internal representation of this shared pointer and to destroy the shared object when all references have been released; if basicAllocator is 0, the currently installed default allocator is used. If an exception is thrown allocating the internal representation, then destroy *ptr with a call to alloc->deleteObject(ptr) where alloc is the chosen allocator, and this shared pointer retains ownership of its original object. If COMPATIBLE_TYPE * is not implicitly convertible to ELEMENT_TYPE *, then a compiler diagnostic will be emitted indicating the error. Note that if ptr is 0, then this shared pointer will still allocate an internal representation to share ownership of that empty state, which will be reclaimed when the last reference is destroyed. Also note that this function is logically equivalent to: ` *this = shared_ptr<ELEMENT_TYPE>(ptr, basicAllocator); `

Synopsis

Declared in <bslstl_sharedptr.h>

template<class COMPATIBLE_TYPE>
void
load(
    COMPATIBLE_TYPE* ptr,
    BloombergLP::bslma::Allocator* basicAllocator);

Description

DEPRECATED: Use reset instead.