[#bsl-shared_ptr-0a-reset-04]
= xref:bsl.adoc[bsl]::xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr]::reset
:relfileprefix: ../../
:mrdocs:

Reset this `shared&lowbar;ptr` as an alias sharing ownership with `source`&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;sharedptr&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ANY&lowbar;TYPE&gt;
void
reset(
    xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr&lt;ANY&lowbar;TYPE&gt;] const& source,
    ELEMENT&lowbar;TYPE* ptr);
----

== Description

Modify this shared pointer to manage the same modifiable object (if any) as the specified `source` shared pointer to the (template parameter) type `ANY&lowbar;TYPE`, and refer to the modifiable object at the specified `ptr` address (i&period;e&period;, make this shared pointer an &quot;alias&quot; of `source`)&period; If this shared pointer is already managing a (possibly shared) object, then release the reference to the shared object, calling the associated deleter to destroy the shared object if this shared pointer is the last reference&period; Note that typically the objects referred to by `source` and `ptr` have identical lifetimes (e&period;g&period;, one might be a part of the other), so that the deleter for `source` will destroy them both, but do not necessarily have the same type&period; Also note that if `source` is empty, then this shared pointer will be reset to an empty state, even if `ptr` is not null (in which case this empty shared pointer will refer to the same object as `ptr`)&period; Also note that if `ptr` is null and `source` is not empty, then this shared pointer will be reset to a (reference&hyphen;counted) null pointer alias&period; Further note that the behavior of this method is the same as `loadAlias(source, ptr)`&period; Finally note that this is a non&hyphen;standard BDE extension to the C&plus;&plus; Standard `shared&lowbar;ptr` interface, which does not provide an alias overload for the `reset` function&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *source*
| source shared pointer that supplies ownership
| *ptr*
| pointer to the object to manage or refer to
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
