GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::experimental::unique_resource(3) C++ Standard Libary std::experimental::unique_resource(3)

std::experimental::unique_resource - std::experimental::unique_resource


Defined in header <experimental/scope>
template<class R, class D> (library fundamentals TS v3)
class unique_resource;


unique_resource is universal RAII wrapper for resource handles that owns and manages
a resource through a handle and disposes of that resource when the unique_resource
is destroyed.


The resource is disposed of using the deleter of type D when either of the following
happens:


* the managing unique_resource object is destroyed
* the managing unique_resource object is assigned from another resource via
operator= or reset().


Let type RS be R if R is an object type, or
std::reference_wrapper<std::remove_reference_t<R>> otherwise:


* unique_resource effectively holds a subobject of type RS which is or wraps the
resource handle, a deleter of type D and a bool flag indicating whether the
wrapper is owning the resource.
* For explanatory purpose, the subobject of type RS is called stored resource
handle, and the stored (if R is an object type) or wrapped (if R is a reference
type) R is called underlying resource handle. These two terms are not used by
the LFTS.


R - resource handle type
D - deleter type


-
R shall be an object type or an lvalue reference to an object type. Let UnrefR be
std::remove_reference_t<R>, UnrefR shall be MoveConstructible, and if UnrefR is not
CopyConstructible, std::is_nothrow_move_constructible_v<UnrefR> shall be true.
-
D shall be a Destructible and MoveConstructible FunctionObject type, and if D is not
CopyConstructible, std::is_nothrow_move_constructible_v<D> shall be true. Given an
lvalue d of type D and an lvalue r of type UnrefR, the expression d(r) shall be
well-formed.


constructor constructs a new unique_resource
(public member function)
destructor disposes the managed resource if such is present
(public member function)
operator= assigns a unique_resource
(public member function)


release releases the ownership
(public member function)
reset disposes or replaces the managed resource
(public member function)


get accesses the underlying resource handle
(public member function)
get_deleter accesses the deleter used for disposing of the managed resource
(public member function)
operator* accesses the pointee if the resource handle is a pointer
operator-> (public member function)


make_unique_resource_checked creates a unique_resource, checking invalid value
(function template)


Deduction guides


Resource handle types satisfying NullablePointer can also be managed by
std::unique_ptr. Unlike unique_ptr, unique_resource does not require
NullablePointer.


This section is incomplete
Reason: no example


unique_ptr smart pointer with unique object ownership semantics
(C++11) (class template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.