|
|
Member functions | ||||
Non-member functions | ||||
inout_ptr |
Defined in header <memory> | ||
template<class Pointer=void,class Smart,class...Args> auto inout_ptr( Smart& s, Args&&...args); | (since C++23) | |
Returns aninout_ptr_t
with deduced template arguments that captures arguments for resetting by reference.
The program is ill-formed if construction of the return value (see below) is ill-formed.
Contents |
s | - | the object (typically a smart pointer) to adapt |
args... | - | the arguments for resetting to capture |
std::inout_ptr_t<Smart, P, Args&&>(s,std::forward<Args>(args)...), whereP
is
Pointer
, ifPointer
is not avoid type, otherwise,Users may specify the template argument for the template parameterPointer
, in order to interoperate with foreign functions that take aPointer*.
As all arguments for resetting are captured by reference, the returnedinout_ptr_t
should be a temporary object destroyed at the end of the full-expression containing the call to the foreign function, in order to avoid dangling references.
Feature-test macro | Value | Std | Feature |
---|---|---|---|
__cpp_lib_out_ptr | 202106L | (C++23) | std::out_ptr ,std::inout_ptr |
202311L | (C++26) | freestandingstd::out_ptr andstd::inout_ptr |
This section is incomplete Reason: no example |
(C++23) | creates anout_ptr_t with an associated smart pointer and resetting arguments(function template)[edit] |
(C++14)(C++20) | creates a unique pointer that manages a new object (function template)[edit] |
creates a shared pointer that manages a new object (function template)[edit] |