# Reference

This header contains definition of `defer_guard` template.

Defer guard that invokes a function upon leaving the scope.

The scope guard wraps a function object callable with no arguments that can be one of:

- A user-defined class with a public `operator()`.

- An lvalue reference to such class.

- An lvalue reference or pointer to function taking no arguments.

The defer guard unconditionally invokes the wrapped function object on destruction.
F &&

The callable function object to invoke on destruction.

Constructs a defer guard with a given callable function object.

Requires: `Func` is constructible from func.

Effects: If `Func` is nothrow constructible from `F&&` then constructs `Func` from `std::forward< F >(func)`, otherwise constructs from `func`.

If `Func` construction throws, invokes func before returning with the exception.

Throws: Nothing, unless construction of the function object throws.

defer_guard
const &
`defer_guard` & ``defer_guard` const &`
Invokes the wrapped callable function object and destroys the callable.

Throws: Nothing, unless invoking the callable throws.

The macro creates a uniquely named defer guard.

The macro should be followed by a function object that should be called on leaving the current scope. Usage example:

    BOOST_SCOPE_DEFER []
    {
        std::cout << "Hello world!" << std::endl;
    };

Using this macro requires C++17.

This header contains definition of `error_code_checker` type.

Error code type.

A predicate for checking whether an error code indicates error.

The predicate captures a reference to an external error code object, which it tests for an error indication when called. The error code object must remain valid for the whole lifetime duration of the predicate.

For an error code object `ec`, an expression `!ec` must be valid, never throw exceptions, and return a value contextually convertible to `bool`. If the returned value converts to `false`, then this is taken as an error indication, and the predicate returns `true`. Otherwise, the predicate returns `false`.

A few examples of error code types:

- `std::error_code` or `boost::system::error_code`,

- `std::expected`, `boost::outcome_v2::basic_outcome` or `boost::outcome_v2::basic_result`,

- `int`, where the value of 0 indicates no error,

- `bool`, where the value of `false` indicates no error,

- `T*`, where a null pointer indicates no error.

Predicate result type.
bool
ErrorCode &
Constructs the predicate.

Upon construction, the predicate saves a reference to the external error code object. The referenced object must remain valid for the whole lifetime duration of the predicate.

Throws: Nothing.

result_type Checks if the error code indicates error.

Throws: Nothing.

As if `!!ec`, where `ec` is the error code object passed to the predicate constructor.

`error_code_checker`< ErrorCode > `ErrorCode &` Creates a predicate for checking whether an exception is being thrown.

Throws: Nothing.

This header contains definition of `exception_checker` type.

A predicate for checking whether an exception is being thrown.

On construction, the predicate captures the current number of uncaught exceptions, which it then compares with the number of uncaught exceptions at the point when it is called. If the number increased then a new exception is detected and the predicate returns `true`.

This predicate is designed for a specific use case with scope guards created on the stack. It is incompatible with C++20 coroutines and similar facilities (e.g. fibers and userspace context switching), where the thread of execution may be suspended after the predicate captures the number of uncaught exceptions and then resumed in a different context, where the number of uncaught exceptions has changed. Similarly, it is incompatible with usage patterns where the predicate is cached after construction and is invoked after the thread has left the scope where the predicate was constructed (e.g. when the predicate is stored as a class data member or a namespace-scope variable).

Predicate result type.
bool
Constructs the predicate.

Upon construction, the predicate saves the current number of uncaught exceptions. This information will be used when calling the predicate to detect if a new exception is being thrown.

Throws: Nothing.

result_type Checks if an exception is being thrown.

Throws: Nothing.

`true` if the number of uncaught exceptions at the point of call is greater than that at the point of construction of the predicate, otherwise `false`.

`exception_checker` Creates a predicate for checking whether an exception is being thrown.

Throws: Nothing.

This header contains definition of a deleter function object for POSIX-like file descriptors for use with `unique_resource`.

POSIX-like file descriptor deleter.
void
result_type `int` Closes the file descriptor.

This header contains definition of `unique_resource` traits for compatibility with POSIX-like file descriptors.

POSIX-like file descriptor resource traits.
int Creates a default fd value.
bool `int` Tests if the fd is allocated (valid)

This header contains definition of `scope_exit` template.

A predicate that always returns `true`.

This predicate can be used as the default condition function object for `scope_exit` and similar scope guards.

Predicate result type.
bool
result_type

Throws: Nothing.

`true`.

Scope guard action function object type.

always_true

Scope guard condition function object type.

Scope exit guard that conditionally invokes a function upon leaving the scope.

The scope guard wraps two function objects: the scope guard action and a condition for invoking the action. Both function objects must be callable with no arguments and can be one of:

- A user-defined class with a public `operator()`.

- An lvalue reference to such class.

- An lvalue reference or pointer to function taking no arguments.

The condition function object `operator()` must return a value contextually convertible to `true`, if the action function object is allowed to be executed, and `false` otherwise. Additionally, the condition function object `operator()` must not throw, as otherwise the action function object may not be called.

The condition function object is optional, and if not specified in template parameters, the scope guard will operate as if the condition always returns `true`.

The scope guard can be in either active or inactive state. By default, the constructed scope guard is active. When active, and condition function object returns `true`, the scope guard invokes the wrapped action function object on destruction. Otherwise, the scope guard does not call the wrapped action function object.

The scope guard can be made inactive by moving-from the scope guard or calling `set_active(false)`. An inactive scope guard can be made active by calling `set_active(true)`. If a moved-from scope guard is active on destruction, the behavior is undefined.

F &&

The callable action function object to invoke on destruction.

bool
true

Indicates whether the scope guard should be active upon construction.

Constructs a scope guard with a given callable action function object.

Requires: `Func` is constructible from func. `Cond` is nothrow default-constructible and is not a pointer to function.

The requirement for `Cond` default constructor to be non-throwing is to allow for the condition function object to be called in case if constructing either function object throws.

Effects: Constructs the scope guard as if by calling `scope_exit(std::forward< F >(func), Cond(), active)`.

Throws: Nothing, unless construction of the function objects throw.

`this->active() == active`

F &&

The callable action function object to invoke on destruction.

C &&

The callable condition function object.

bool
true

Indicates whether the scope guard should be active upon construction.

Constructs a scope guard with a given callable action and condition function objects.

Requires: `Func` is constructible from func. `Cond` is constructible from cond.

Effects: If `Func` is nothrow constructible from `F&&` then constructs `Func` from `std::forward< F >(func)`, otherwise constructs from `func`. If `Cond` is nothrow constructible from `C&&` then constructs `Cond` from `std::forward< C >(cond)`, otherwise constructs from `cond`.

If `Func` or `Cond` construction throws and active is `true`, invokes cond and, if it returns `true`, func before returning with the exception.

Throws: Nothing, unless construction of the function objects throw.

`this->active() == active`

scope_exit
&&

Move source.

Move-constructs a scope guard.

Requires: `Func` and `Cond` are nothrow move-constructible or copy-constructible.

Effects: If `Func` is nothrow move-constructible then move-constructs `Func` from a member of that, otherwise copy-constructs `Func`. If `Cond` is nothrow move-constructible then move-constructs `Cond` from a member of that, otherwise copy-constructs `Cond`.

If `Func` or `Cond` construction throws and `that.active() == true`, invokes `Cond` object stored in that and, if it returns `true`, Func object (either the newly constructed one, if its construction succeeded, or the original one stored in that) before returning with the exception.

If the construction succeeds, marks that as inactive.

Throws: Nothing, unless move-construction of the function objects throw.

`that.active() == false`

`scope_exit` & ``scope_exit` &&`
scope_exit
const &
`scope_exit` & ``scope_exit` const &`
If `active() == true`, and invoking the condition function object returns `true`, invokes the wrapped callable action function object. Destroys the function objects.

Throws: Nothing, unless invoking a function object throws.

bool Returns `true` if the scope guard is active, otherwise `false`.

This method does not call the condition function object specified on construction.

Throws: Nothing.
void `bool

The active status to set.

` Activates or deactivates the scope guard.

Throws: Nothing.

`this->active() == active`

`scope_exit`< typename std::decay< F >::type > `F &&

The callable action function object to invoke on destruction.

` `booltrue

Indicates whether the scope guard should be active upon construction.

` Creates a scope guard with a given action function object.

Effects: Constructs a scope guard as if by calling `scope_exit< std::decay_t< F > >(std::forward< F >(func), active)`.

`scope_exit`< typename std::decay< F >::type, typename std::decay< C >::type > `F &&

The callable action function object to invoke on destruction.

` `C &&

The callable condition function object.

` `booltrue

Indicates whether the scope guard should be active upon construction.

` Creates a conditional scope guard with given callable function objects.

Effects: Constructs a scope guard as if by calling `scope_exit< std::decay_t< F >, std::decay_t< C > >( std::forward< F >(func), std::forward< C >(cond), active)`.

This header contains definition of `scope_fail` template.

Scope guard action function object type.

exception_checker

Scope guard failure condition function object type.

scope_exit< Func, exception_checker >
Scope exit guard that invokes a function upon leaving the scope, if a failure condition is satisfied.

The scope guard wraps two function objects: the scope guard action and a failure condition for invoking the action. Both function objects must be callable with no arguments and can be one of:

- A user-defined class with a public `operator()`.

- An lvalue reference to such class.

- An lvalue reference or pointer to function taking no arguments.

The condition function object `operator()` must return a value contextually convertible to `true`, if the failure is detected and the action function object is allowed to be executed, and `false` otherwise. Additionally, the failure condition function object `operator()` must not throw, as otherwise the action function object may not be called. If not specified, the default failure condition checks whether the scope is left due to an exception - the action function object will not be called if the scope is left normally.

# See Also:

scope_exit

# See Also:

scope_success

F &&

The callable action function object to invoke on destruction.

bool
true

Indicates whether the scope guard should be active upon construction.

Constructs a scope guard with a given callable function object.

Requires: `Func` is constructible from func. `Cond` is nothrow default-constructible.

Effects: Constructs the scope guard as if by calling `scope_fail(std::forward< F >(func), Cond(), active)`.

Throws: Nothing, unless construction of the function objects throw.

`this->active() == active`

F &&

The callable action function object to invoke on destruction.

C &&

The callable failure condition function object.

bool
true

Indicates whether the scope guard should be active upon construction.

Constructs a scope guard with a given callable action and failure condition function objects.

Requires: `Func` is constructible from func. `Cond` is constructible from cond.

Effects: If `Func` is nothrow constructible from `F&&` then constructs `Func` from `std::forward< F >(func)`, otherwise constructs from `func`. If `Cond` is nothrow constructible from `C&&` then constructs `Cond` from `std::forward< C >(cond)`, otherwise constructs from `cond`.

If `Func` or `Cond` construction throws and active is `true`, invokes cond and, if it returns `true`, func before returning with the exception.

Throws: Nothing, unless construction of the function objects throw.

`this->active() == active`

scope_fail
&&

Move source.

Move-constructs a scope guard.

Requires: `Func` and `Cond` are nothrow move-constructible or copy-constructible.

Effects: If `Func` is nothrow move-constructible then move-constructs `Func` from a member of that, otherwise copy-constructs `Func`. If `Cond` is nothrow move-constructible then move-constructs `Cond` from a member of that, otherwise copy-constructs `Cond`.

If `Func` or `Cond` construction throws and `that.active() == true`, invokes `Cond` object stored in that and, if it returns `true`, Func object (either the newly constructed one, if its construction succeeded, or the original one stored in that) before returning with the exception.

If the construction succeeds, marks that as inactive.

Throws: Nothing, unless move-construction of the function objects throw.

`that.active() == false`

`scope_fail` & ``scope_fail` &&`
scope_fail
const &
`scope_fail` & ``scope_fail` const &`
`scope_fail`< typename std::decay< F >::type > `F &&

The callable function object to invoke on destruction.

` `booltrue

Indicates whether the scope guard should be active upon construction.

` Creates a scope fail guard with a given action function object.

Effects: Constructs a scope guard as if by calling `scope_fail< std::decay_t< F > >(std::forward< F >(func), active)`.

`scope_fail`< typename std::decay< F >::type, typename std::decay< C >::type > `F &&

The callable action function object to invoke on destruction.

` `C &&

The callable failure condition function object.

` `booltrue

Indicates whether the scope guard should be active upon construction.

` Creates a scope fail with given callable function objects.

Effects: Constructs a scope guard as if by calling `scope_fail< std::decay_t< F >, std::decay_t< C > >( std::forward< F >(func), std::forward< C >(cond), active)`.

This header contains definition of `scope_success` template.

Scope guard action function object type.

exception_checker

Scope guard failure condition function object type.

Scope exit guard that invokes a function upon leaving the scope, if a failure condition is not satisfied.

The scope guard wraps two function objects: the scope guard action and a failure condition for invoking the action. Both function objects must be callable with no arguments and can be one of:

- A user-defined class with a public `operator()`.

- An lvalue reference to such class.

- An lvalue reference or pointer to function taking no arguments.

The condition function object `operator()` must return a value contextually convertible to `true`, if the failure is detected and the action function object is not allowed to be executed, and `false` otherwise. Additionally, the failure condition function object `operator()` must not throw, as otherwise the action function object may not be called. If not specified, the default failure condition checks whether the scope is left due to an exception - the action function object will only be called if the scope is left normally.

# See Also:

scope_exit

# See Also:

scope_fail

F &&

The callable action function object to invoke on destruction.

bool
true

Indicates whether the scope guard should be active upon construction.

Constructs a scope guard with a given callable function object.

Requires: `Func` is constructible from func. `Cond` is nothrow default-constructible.

Effects: Constructs the scope guard as if by calling `scope_success(std::forward< F >(func), Cond(), active)`.

Throws: Nothing, unless construction of the function objects throw.

`this->active() == active`

F &&

The callable action function object to invoke on destruction.

C &&

The callable failure condition function object.

bool
true

Indicates whether the scope guard should be active upon construction.

Constructs a scope guard with a given callable action and failure condition function objects.

Requires: `Func` is constructible from func. `Cond` is constructible from cond.

Effects: If `Func` is nothrow constructible from `F&&` then constructs `Func` from `std::forward< F >(func)`, otherwise constructs from `func`. If `Cond` is nothrow constructible from `C&&` then constructs `Cond` from `std::forward< C >(cond)`, otherwise constructs from `cond`.

If `Func` or `Cond` construction throws and active is `true`, invokes cond and, if it returns `true`, func before returning with the exception.

Throws: Nothing, unless construction of the function objects throw.

`this->active() == active`

scope_success
&&

Move source.

Move-constructs a scope guard.

Requires: `Func` and `Cond` are nothrow move-constructible or copy-constructible.

Effects: If `Func` is nothrow move-constructible then move-constructs `Func` from a member of that, otherwise copy-constructs `Func`. If `Cond` is nothrow move-constructible then move-constructs `Cond` from a member of that, otherwise copy-constructs `Cond`.

If `Func` or `Cond` construction throws and `that.active() == true`, invokes `Cond` object stored in that and, if it returns `true`, Func object (either the newly constructed one, if its construction succeeded, or the original one stored in that) before returning with the exception.

If the construction succeeds, marks that as inactive.

Throws: Nothing, unless move-construction of the function objects throw.

`that.active() == false`

`scope_success` & ``scope_success` &&`
scope_success
const &
`scope_success` & ``scope_success` const &`
`scope_success`< typename std::decay< F >::type > `F &&

The callable function object to invoke on destruction.

` `booltrue

Indicates whether the scope guard should be active upon construction.

` Creates a scope fail guard with a given action function object.

Effects: Constructs a scope guard as if by calling `scope_success< std::decay_t< F > >(std::forward< F >(func), active)`.

`scope_success`< typename std::decay< F >::type, typename std::decay< C >::type > `F &&

The callable action function object to invoke on destruction.

` `C &&

The callable failure condition function object.

` `booltrue

Indicates whether the scope guard should be active upon construction.

` Creates a scope fail with given callable function objects.

Effects: Constructs a scope guard as if by calling `scope_success< std::decay_t< F >, std::decay_t< C > >( std::forward< F >(func), std::forward< C >(cond), active)`.

This header contains definition of `unique_fd` type.

Unique POSIX-like file descriptor resource.
`unique_resource`< int, `fd_deleter`, `fd_resource_traits` >

This header contains definition of `unique_resource` template.

auto
auto...
Simple resource traits for one or more unallocated resource values.

This class template generates resource traits for `unique_resource` that specify one or more unallocated resource values. The first value, specified in the `DefaultValue` non-type template parameter, is considered the default. The other values, listed in `UnallocatedValues`, are optional. Any resource values other than `DefaultValue` or listed in `UnallocatedValues` are considered as allocated.

In order for the generated resource traits to enable optimized implementation of `unique_resource`, the resource type must support non-throwing construction and assignment from, and comparison for (in)equality with `DefaultValue` or any of the resource values listed in `UnallocatedValues`.

decltype(DefaultValue) Returns the default resource value.
bool `Resource const &` Tests if res is an allocated resource value.
default_resource_t Keyword representing default, unallocated resource argument.
`unique_resource`< typename std::decay< Resource >::type, typename std::decay< Deleter >::type > typename std::decay< Resource >::type `Resource &&

Resource to wrap.

` `Invalid const &

An invalid value for the resource.

` `Deleter &&

A deleter to invoke on the resource to free it.

` Checks if the resource is valid and creates a `unique_resource` wrapper.

Effects: If the resource res is not equal to invalid, creates a unique resource wrapper that is in allocated state and owns res. Otherwise creates a unique resource wrapper in unallocated state.

This function does not call del if res is equal to invalid.

Throws: Nothing, unless `unique_resource` constructor throws.

This header contains forward declaration of `unique_resource` template.

Resource type.

Resource deleter function object type.

void

Optional resource traits type.

RAII wrapper for automatically reclaiming arbitrary resources.

A `unique_resource` object exclusively owns wrapped resource and invokes the deleter function object on it on destruction. The wrapped resource can have any type that is:

- Move-constructible, where the move constructor is marked as `noexcept`, or

- Copy-constructible, or

- An lvalue reference to an object type.

The deleter must be a function object type that is callable on an lvalue of the resource type. The deleter must be copy-constructible.

An optional resource traits template parameter may be specified. Resource traits can be used to optimize `unique_resource` implementation when the following conditions are met:

- There is at least one value of the resource type that is considered unallocated (that is, no allocated resource shall be equal to one of the unallocated resource values). The unallocated resource values need not be deallocated using the deleter.

- One of the unallocated resource values can be considered the default. Constructing the default resource value and assigning it to a resource object (whether allocated or not) shall not throw exceptions.

- Resource objects can be tested for being unallocated. Such a test shall not throw exceptions.

If specified, the resource traits must be a class type that has the following public static members:

- `R make_default() noexcept` - must return the default resource value such that `std::is_constructible< Resource, R >::value && std::is_nothrow_assignable< Resource&, R >::value` is `true`.

- `bool is_allocated(Resource const& res) noexcept` - must return `true` if `res` is not one of the unallocated resource values and `false` otherwise.

Note that `is_allocated(make_default())` must always return `false`.

When resource traits satisfying the above requirements are specified, `unique_resource` will be able to avoid storing additional indication of whether the owned resource object needs to be deallocated with the deleter on destruction. It will use the default resource value to initialize the owned resource object when `unique_resource` is not in the allocated state. Additionally, it will be possible to construct `unique_resource` with unallocated resource values, which will create `unique_resource` objects in unallocated state (the deleter will not be called on unallocated resource values).

Constructs an unallocated unique resource guard.

Requires: Default `Resource` value can be constructed. `Deleter` is default-constructible and is not a pointer to function.

Effects: Initializes the `Resource` object with the default resource value. Default-constructs the `Deleter` object.

Throws: Nothing, unless construction of `Resource` or `Deleter` throws.

`this->allocated() == false`

default_resource_t

A tag argument indicating default resource value.

D &&

Resource deleter function object.

Constructs an unallocated unique resource guard with the given deleter.

Requires: Default `Resource` value can be constructed and `Deleter` is constructible from del.

Effects: Initializes the `Resource` value with the default resource value. If `Deleter` is nothrow constructible from `D&&` then constructs `Deleter` from `std::forward< D >(del)`, otherwise constructs from `del`.

Throws: Nothing, unless construction of `Resource` or `Deleter` throws.

`this->allocated() == false`

R &&

Resource object.

Constructs a unique resource guard with the given resource and a default-constructed deleter.

Requires: `Resource` is constructible from res. `Deleter` is default-constructible and is not a pointer to function.

Effects: Constructs the unique resource object as if by calling `unique_resource(std::forward< R >(res), Deleter())`.

Throws: Nothing, unless construction of `Resource` or `Deleter` throws.

R &&

Resource object.

D &&

Resource deleter function object.

Constructs a unique resource guard with the given resource and deleter.

Requires: `Resource` is constructible from res and `Deleter` is constructible from del.

Effects: If `Resource` is nothrow constructible from `R&&` then constructs `Resource` from `std::forward< R >(res)`, otherwise constructs from `res`. If `Deleter` is nothrow constructible from `D&&` then constructs `Deleter` from `std::forward< D >(del)`, otherwise constructs from `del`.

If construction of `Resource` or `Deleter` throws and res is not an unallocated resource value, invokes del on res (if `Resource` construction failed) or the constructed `Resource` object (if `Deleter` construction failed).

Throws: Nothing, unless construction of `Resource` or `Deleter` throws.

If res is an unallocated resource value then `this->allocated() == false`, otherwise `this->allocated() == true`.

unique_resource
const &
`unique_resource` & ``unique_resource` const &`
unique_resource
&&

Move source.

Move-constructs a unique resource guard.

Requires: `Resource` and `Deleter` are move-constructible.

Effects: If `Resource` is nothrow move-constructible then move-constructs `Resource`, otherwise copy-constructs. If `Deleter` is nothrow move-constructible then move-constructs `Deleter`, otherwise copy-constructs. Deactivates the moved-from unique resource object.

If an exception is thrown during construction, that is left in its original state.

This logic ensures that in case of exception the resource is not leaked and remains owned by the move source.

Throws: Nothing, unless construction of `Resource` or `Deleter` throws.

Let `allocated` be equal to `that.allocated()` prior to the operation. Then `this->allocated() == allocated` and `that.allocated() == false`.

`unique_resource` & ``unique_resource` &&

Move source.

` Move-assigns a unique resource guard.

Requires: `Resource` and `Deleter` are move-assignable.

Effects: Calls `this->reset()`. Then, if `Deleter` is nothrow move-assignable, move-assigns the `Deleter` object first and the `Resource` object next. Otherwise, move-assigns the objects in reverse order. Lastly, deactivates the moved-from unique resource object.

If an exception is thrown, that is left in its original state.

The different orders of assignment ensure that in case of exception the resource is not leaked and remains owned by the move source.

Throws: Nothing, unless assignment of `Resource` or `Deleter` throws.

Let `allocated` be equal to `that.allocated()` prior to the operation. Then `this->allocated() == allocated` and `that.allocated() == false`.

If the resource is allocated, calls the deleter function on it. Destroys the resource and the deleter.

Throws: Nothing, unless invoking the deleter throws.

bool Returns `true` if the resource is allocated and to be reclaimed by the deleter, otherwise `false`.

This method does not test the value of the resource.

Throws: Nothing.
bool Returns `true` if the resource is allocated and to be reclaimed by the deleter, otherwise `false`.

Throws: Nothing.

resource_type const & Returns a reference to the resource object.

Throws: Nothing.

deleter_type const & Returns a reference to the deleter object.

Throws: Nothing.

void Marks the resource as unallocated. Does not call the deleter if the resource was previously allocated.

Throws: Nothing.

`this->allocated() == false`

void If the resource is allocated, calls the deleter function on it and marks the resource as unallocated.

Throws: Nothing, unless invoking the deleter throws.

`this->allocated() == false`

void `R &&

Resource object to assign.

` Assigns a new resource object to the unique resource wrapper.

Effects: Calls `this->reset()`. Then, if `Resource` is nothrow assignable from `R&&`, assigns `std::forward< R >(res)` to the stored resource object, otherwise assigns `res`.

If res is not an unallocated resource value and an exception is thrown during the operation, invokes the stored deleter on res before returning with the exception.

Throws: Nothing, unless invoking the deleter throws.

`this->allocated() == false`

resource_type const & Invokes indirection on the resource object.

Requires: `Resource` is dereferenceable.

Effects: Returns a reference to the resource object as if by calling `get()`.

If `Resource` is not a pointer type, the compiler will invoke its `operator->`. Such call sequence will continue until a pointer is obtained.

Throws: Nothing. Note that any implicit subsequent calls to other `operator->` functions that are caused by this call may have different throw conditions.
auto Dereferences the resource object.

Requires: `Resource` is dereferenceable.

Effects: Returns the result of dereferencing the resource object as if by calling `*get()`.

Throws: Nothing, unless dereferencing the resource object throws.

void ``unique_resource` &

Unique resource wrapper to swap with.

` Swaps two unique resource wrappers.

Requires: `Resource` and `Deleter` are swappable. At least one of `Resource` and `Deleter` is nothrow swappable.

Effects: Swaps the resource objects and deleter objects stored in `*this` and that as if by calling unqualified `swap` in a context where `std::swap` is found by overload resolution.

If an exception is thrown, and the failed swap operation supports strong exception guarantee, both `*this` and that are left in their original states.

Throws: Nothing, unless swapping the resource objects or deleters throw.

void ``unique_resource` &` ``unique_resource` &` Swaps two unique resource wrappers.

Effects: As if `left.swap(right)`.