std::experimental::unique_resource<R, D>::reset
From cppreference.com
< cpp | experimental | unique resource
C++
Experimental
| Technical Specification | ||||
| Filesystem library (filesystem TS) | ||||
| Library fundamentals (library fundamentals TS) | ||||
| Library fundamentals 2 (library fundamentals TS v2) | ||||
| Library fundamentals 3 (library fundamentals TS v3) | ||||
| Extensions for parallelism (parallelism TS) | ||||
| Extensions for parallelism 2 (parallelism TS v2) | ||||
| Extensions for concurrency (concurrency TS) | ||||
| Extensions for concurrency 2 (concurrency TS v2) | ||||
| Concepts (concepts TS) | ||||
| Ranges (ranges TS) | ||||
| Reflection (reflection TS) | ||||
| Mathematical special functions (special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
Library fundamentals v3
std::experimental::unique_resource
| Member functions | ||||
| Modifiers | ||||
unique_resource::reset | ||||
| Observers | ||||
| Non-member functions | ||||
| Deduction guides |
| void reset() noexcept; |
(1) | (library fundamentals TS v3) |
| template< class RR > void reset( RR&& r ); |
(2) | (library fundamentals TS v3) |
1) Disposes the resource by calling the deleter with the underlying resource handle if the
unique_resource owns it. The unique_resource does not own the resource after the call.2) Replaces the resource by calling (1) and then assigns the stored resource handle with std::forward<RR>(r) if std::is_nothrow_assignable_v<RS, RR> is true, otherwise std::as_const(r), where
RS is the type of stored resource handle. The unique_resource owns the resource after the call. If copy-assignment of the store resource handle throws an exception, calls del_(r), where
del is the deleter object. This overload participates in overload resolution only if the selected assignment expression assigning the stored resource handle is well-formed.
The program is ill-formed if del_(r) is ill-formed.
The behavior is undefined if del_(r) results in undefined behavior or throws an exception.
Contents |
[edit] Parameters
| r | - | resource handle for a new resource to manage |
[edit] Return value
(none)
[edit] Exceptions
2) Any exception thrown in assigning the stored resource handle.
[edit] Notes
The mechanism ensures no leaking of resources.
[edit] Example
| This section is incomplete Reason: no example |
[edit] See also
| replaces the managed object (public member function of std::unique_ptr<T,Deleter>) [edit]
|