chsvlib
chsv helper source code

◆ AutoResource() [21/28]

AutoResource ( handle_rref  rrefHandle,
checker_rref  rrefChecker 
)

Constructs an AutoResource object from an rvalue handle and checker using move semantics, with the default closer object.

Parameters
rrefHandleis an rvalue reference to a resource handle which is to be owned and managed by the created object.
rrefCheckeris an rvalue reference to a checker object to be used to check if a managed handle is allowed to be closed by the closer.
Remarks
The object takes ownership of the handle, initializing its stored handle and checker and value-initializing its stored closer.
The only handles closed are the ones which are allowed to be closed by the checker.
Warning
The checker callable object must not allow the closing of the default constructed handle (i.e. handle_type()).