cpp/memory/shared ptr/reset

Replaces the managed object with an object pointed to by. Optional deleter can be supplied, which is later used to destroy the new object when no  objects own it. By default, expression is used as deleter. Proper expression corresponding to the supplied type is always selected, this is the reason why the function is implemented as template using a separate parameter.

If already owns an object and it is the last  owning it, the object is destroyed through the owned deleter.

If the object pointed to by is already owned, the function generally results in undefined behavior.

@1@ Releases the ownership of the managed object, if any. After the call, manages no object. Equivalent to

@2-4@ Replaces the managed object with an object pointed to by. must be a complete type and implicitly convertible to. Additionally:


 * @2@ Uses the delete expression as the deleter. A valid delete expression must be available, i.e. must be well formed, have well-defined behavior and not throw any exceptions. Equivalent to.


 * @3@ Uses the specified deleter as the deleter.  must be callable for the type, i.e.  must be well formed, have well-defined behavior and not throw any exceptions.  must be , and its copy constructor and destructor must not throw exceptions. Equivalent to.


 * @4@ Same as, but additionally uses a copy of for allocation of data for internal use.  must be an . The copy constructor and destructor must not throw exceptions. Equivalent to.

Return value
(none)

Exceptions
@2@ std if required additional memory could not be obtained. May throw implementation-defined exception for other errors. is called if an exception occurs.

@3-4@ std if required additional memory could not be obtained. May throw implementation-defined exception for other errors. is called if an exception occurs.