| ~out_ptr_t(); |
(since C++23) | |
Resets the adapted Smart object by the value of modified Pointer object (or the void* object if operator void**() has been called) and the captured arguments.
Let
-
sdenotes the adaptedSmartobject, -
args...denotes the captured arguments, -
pdenotes the value of storedPointer, orstatic_cast<Pointer>(*operator void**())ifoperator void**has been called, -
SPbe-
Smart::pointer, if it is valid and denotes a type, otherwise, -
Smart::element_type*, ifSmart::element_typeis valid and denotes a type, otherwise, -
std::pointer_traits<Smart>::element_type*, ifstd::pointer_traits<Smart>::element_typeis valid and denotes a type, otherwise, -
Pointer.
-
If s.reset(static_cast<SP>(p), std::forward<Args>(args)...) is well-formed, the destructor performs
if (p) s.reset(static_cast<SP>(p), std::forward<Args>(args)...);,
otherwise, if std::is_constructible_v<Smart, SP, Args...> is true, the destructor performs
if (p) s = Smart(static_cast<SP>(p), std::forward<Args>(args)...);,
otherwise, the program is ill-formed.
Notes
If Smart is a std::shared_ptr specialization, the implementation may allocate the storage for the new control block on construction, in order to leave non-throwing works to the destructor.
Arguments captured by value are destroyed after resetting.
Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.