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. The currently installed default allocator is used to allocate the internal representation of this shared pointer, and the shared object will be destroyed by a call to delete ptr when all references have been released. If an exception is thrown allocating the internal representation, then delete ptr is called 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.

Synopsis

Declared in <bslstl_sharedptr.h>

template<class COMPATIBLE_TYPE>
void
reset(COMPATIBLE_TYPE* ptr)
requires is_convertible<COMPATIBLE_TYPE *, ELEMENT_TYPE *>::value;

Created with MrDocs