std::out_ptr_t<Smart,Pointer,Args...>::out_ptr_t

From cppreference.com
< cpp‎ | memory‎ | out ptr t
Memory management library
(exposition only*)
Uninitialized memory algorithms
(C++17)
(C++17)
(C++17)
(C++20)
Constrained uninitialized
memory algorithms
(C++20)
C Library

Allocators
(C++11)
(C++11)
Memory resources
Garbage collection support
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
Uninitialized storage
(until C++20*)
(until C++20*)
(until C++20*)
Explicit lifetime management
std::out_ptr_t
Member functions
out_ptr_t::out_ptr_t
Non-member functions
explicit out_ptr_t( Smart &sp, Args... args );
(1) (since C++23)
out_ptr_t( const out_ptr_t& ) = delete;
(2) (since C++23)
1) Creates an out_ptr_t. Adapts sp as if binds it to the Smart& member, captures every argument t in args... as if initializes the corresponding member of type T in Args... with std::forward <T> (t) , then value-initializes the stored Pointer.
Then calls sp.reset() if the expression is well-formed; otherwise, calls sp = Smart() if std::is_default_constructible_v<Smart> is true
2) Copy constructor is explicitly deleted. out_ptr_t is neither copyable nor movable.

Parameters

sp - the object (typically a smart pointer) to adapt
args... - the arguments used for resetting to capture

Return value

(none)

Exceptions

May throw implementation-defined exceptions.

Notes

After construction, the Pointer or void* object pointed by the return value of either conversion function is equal to nullptr

Every argument in args... is moved into the created out_ptr_t if it is of an object type, or transferred into the created out_ptr_t

The constructor of out_ptr_t is allowed to throw exceptions. For example, when sp is a std::shared_ptr

Example