= Reference
:mrdocs:

[#index]

= Global namespace

== Namespaces
[,cols=2]
|===
|Name |Description
|xref:boost[`pass:v[boost]`] |

|===

[#boost]

= Namespace boost

== Namespaces
[,cols=2]
|===
|Name |Description
|xref:boost-scope[`pass:v[scope]`] |

|===

[#boost-scope]

= Namespace scope

==  Types
[,cols=2]
|===
|Name |Description
|xref:boost-scope-always_true[`pass:v[always_true]`] |
pass:v,q[A predicate that always returns] `true.`

|xref:boost-scope-default_resource_t[`pass:v[default_resource_t]`] |

|xref:boost-scope-error_code_checker[`pass:v[error_code_checker]`] |
pass:v,q[A predicate for checking whether an error code indicates error.]

|xref:boost-scope-exception_checker[`pass:v[exception_checker]`] |
pass:v,q[A predicate for checking whether an exception is being thrown.]

|xref:boost-scope-fd_deleter[`pass:v[fd_deleter]`] |
pass:v,q[POSIX-like file descriptor deleter]

|xref:boost-scope-fd_resource_traits[`pass:v[fd_resource_traits]`] |
pass:v,q[POSIX-like file descriptor resource traits]

|xref:boost-scope-scope_exit-0a[`pass:v[scope_exit]`] |
pass:v,q[Scope exit guard that conditionally invokes a function upon leaving the scope.]

|xref:boost-scope-scope_fail-04[`pass:v[scope_fail]`] |
pass:v,q[Scope exit guard that invokes a function upon leaving the scope with] pass:v,q[a failure condition satisfied.]

|xref:boost-scope-scope_final-00[`pass:v[scope_final]`] |
pass:v,q[Scope final guard that invokes a function upon leaving the scope.]

|xref:boost-scope-scope_success-0ec[`pass:v[scope_success]`] |
pass:v,q[Scope exit guard that invokes a function upon leaving the scope with] pass:v,q[a failure condition not satisfied.]

|xref:boost-scope-unique_fd[`pass:v[unique_fd]`] |
pass:v,q[Unique POSIX-like file descriptor resource]

|xref:boost-scope-unique_resource-0c[`pass:v[unique_resource]`] |
pass:v,q[RAII wrapper for automatically reclaiming arbitrary resources.]

|===
== Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-check_error_code[`pass:v[check_error_code]`] |
pass:v,q[Creates a predicate for checking whether an exception is being thrown]

|xref:boost-scope-check_exception[`pass:v[check_exception]`] |
pass:v,q[Creates a predicate for checking whether an exception is being thrown]

|xref:boost-scope-make_scope_exit[`pass:v[make_scope_exit]`] |
pass:v,q[Creates a scope guard with a given action function object.]

|xref:boost-scope-make_scope_fail[`pass:v[make_scope_fail]`] |
pass:v,q[Creates a scope fail guard with a given action function object.]

|xref:boost-scope-make_scope_success[`pass:v[make_scope_success]`] |
pass:v,q[Creates a scope fail guard with a given action function object.]

|xref:boost-scope-make_unique_resource_checked[`pass:v[make_unique_resource_checked]`] |
pass:v,q[Checks if the resource is valid and creates a] `unique_resource` pass:v,q[wrapper.]

|xref:boost-scope-swap[`pass:v[swap]`] |

|===
== Variables
[,cols=2]
|===
|Name |Description
|xref:boost-scope-default_resource[`pass:v[default_resource]`] |
pass:v,q[Keyword representing default, unallocated resource argument]

|===
==  Deduction Guides
[,cols=2]
|===
|Name |Description
|xref:boost-scope-scope_exit-05[`pass:v[scope_exit<Func>]`] |

|xref:boost-scope-scope_exit-076[`pass:v[scope_exit<Func>]`] |

|xref:boost-scope-scope_exit-07b[`pass:v[scope_exit<Func, Cond>]`] |

|xref:boost-scope-scope_exit-04[`pass:v[scope_exit<Func, Cond>]`] |

|xref:boost-scope-scope_fail-0a[`pass:v[scope_fail<Func>]`] |

|xref:boost-scope-scope_fail-09[`pass:v[scope_fail<Func>]`] |

|xref:boost-scope-scope_fail-08[`pass:v[scope_fail<Func, Cond>]`] |

|xref:boost-scope-scope_fail-0c[`pass:v[scope_fail<Func, Cond>]`] |

|xref:boost-scope-scope_final-08[`pass:v[scope_final<Func>]`] |

|xref:boost-scope-scope_success-0c[`pass:v[scope_success<Func>]`] |

|xref:boost-scope-scope_success-0ef[`pass:v[scope_success<Func>]`] |

|xref:boost-scope-scope_success-08b[`pass:v[scope_success<Func, Cond>]`] |

|xref:boost-scope-scope_success-08c[`pass:v[scope_success<Func, Cond>]`] |

|xref:boost-scope-unique_resource-07[`pass:v[unique_resource<Resource, Deleter>]`] |

|===

[#boost-scope-error_code_checker]

= Class error_code_checker

pass:v,q[A predicate for checking whether an error code indicates error.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/error_code_checker.hpp#L51[boost/scope/error_code_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename ErrorCode>
class error_code_checker;
----

==  Types
[,cols=2]
|===
|Name |Description
|xref:boost-scope-error_code_checker-result_type[`pass:v[result_type]`] |
pass:v,q[Predicate result type]

|===
==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-error_code_checker-2constructor[`pass:v[error_code_checker]`] |
pass:v,q[Constructs the predicate.]

|xref:boost-scope-error_code_checker-operator_call[`pass:v[operator()]`] |
pass:v,q[Checks if the error code indicates error.]

|===

== Description

pass:v,q[The predicate captures a reference to an external error code object, which it]
pass:v,q[tests for an error indication when called. The error code object must remain]
pass:v,q[valid for the whole lifetime duration of the predicate.]
pass:v,q[For an error code object `ec`, an expression `!ec` must be valid, never throw exceptions,]
pass:v,q[and return a value contextually convertible to `bool`. If the returned value converts]
pass:v,q[to `false`, then this is taken as an error indication, and the predicate returns `true`.]
pass:v,q[Otherwise, the predicate returns `false`.]
pass:v,q[A few examples of error code types:]

* pass:v,q[`std::error_code` or `boost::system::error_code`,]

* pass:v,q[`std::expected`, `boost::outcome_v2::basic_outcome` or `boost::outcome_v2::basic_result`,]

* pass:v,q[`int`, where the value of 0 indicates no error,]

* pass:v,q[`bool`, where the value of `false` indicates no error,]

* pass:v,q[`T*`, where a null pointer indicates no error.]




[#boost-scope-error_code_checker-result_type]

= error_code_checker::result_type

pass:v,q[Predicate result type]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/error_code_checker.hpp#L55[boost/scope/error_code_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
typedef bool result_type;
----


[#boost-scope-error_code_checker-2constructor]

= Function error_code_checker::error_code_checker

pass:v,q[Constructs the predicate.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/error_code_checker.hpp#L69[boost/scope/error_code_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
error_code_checker(ErrorCode& ec) noexcept;
----

== Description

pass:v,q[Upon construction, the predicate saves a reference to the external error code object.]
pass:v,q[The referenced object must remain valid for the whole lifetime duration of the predicate.]
pass:v,q[**Throws:** Nothing.]




== Parameters

|===
| Name | Type 

| *ec*
| `ErrorCode&`

|===




[#boost-scope-error_code_checker-operator_call]

= Function error_code_checker::operator()

pass:v,q[Checks if the error code indicates error.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/error_code_checker.hpp#L81[boost/scope/error_code_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-error_code_checker-result_type[result_type]
operator()() const noexcept;
----

== Description

pass:v,q[**Throws:** Nothing.]



== Return Value

* `xref:boost-scope-error_code_checker-result_type[result_type]` 





[#boost-scope-check_error_code]

= Function check_error_code

pass:v,q[Creates a predicate for checking whether an exception is being thrown]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/error_code_checker.hpp#L93[boost/scope/error_code_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename ErrorCode>
xref:boost-scope-error_code_checker[error_code_checker]<ErrorCode>
check_error_code(ErrorCode& ec) noexcept;
----

== Description

pass:v,q[**Throws:** Nothing.]



== Return Value

* `xref:boost-scope-error_code_checker[error_code_checker]<ErrorCode>` 


== Parameters

|===
| Name | Type 

| *ec*
| `ErrorCode&`

|===




[#boost-scope-exception_checker]

= Class exception_checker

pass:v,q[A predicate for checking whether an exception is being thrown.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/exception_checker.hpp#L47[boost/scope/exception_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
class exception_checker;
----

==  Types
[,cols=2]
|===
|Name |Description
|xref:boost-scope-exception_checker-result_type[`pass:v[result_type]`] |
pass:v,q[Predicate result type]

|===
==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-exception_checker-2constructor[`pass:v[exception_checker]`] |
pass:v,q[Constructs the predicate.]

|xref:boost-scope-exception_checker-operator_call[`pass:v[operator()]`] |
pass:v,q[Checks if an exception is being thrown.]

|===

== Description

pass:v,q[On construction, the predicate captures the current number of uncaught exceptions,]
pass:v,q[which it then compares with the number of uncaught exceptions at the point when it]
pass:v,q[is called. If the number increased then a new exception is detected and the predicate]
pass:v,q[returns]
`true.`
[NOTE]
pass:v,q[This predicate is designed for a specific use case with scope guards created on]
pass:v,q[the stack. It is incompatible with C++20 coroutines and similar facilities (e.g.]
pass:v,q[fibers and userspace context switching), where the thread of execution may be]
pass:v,q[suspended after the predicate captures the number of uncaught exceptions and]
pass:v,q[then resumed in a different context, where the number of uncaught exceptions]
pass:v,q[has changed. Similarly, it is incompatible with usage patterns where the predicate]
pass:v,q[is cached after construction and is invoked after the thread has left the scope]
pass:v,q[where the predicate was constructed (e.g. when the predicate is stored as a class]
pass:v,q[data member or a namespace-scope variable).]




[#boost-scope-exception_checker-result_type]

= exception_checker::result_type

pass:v,q[Predicate result type]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/exception_checker.hpp#L51[boost/scope/exception_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
typedef bool result_type;
----


[#boost-scope-exception_checker-2constructor]

= Function exception_checker::exception_checker

pass:v,q[Constructs the predicate.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/exception_checker.hpp#L66[boost/scope/exception_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
exception_checker() noexcept;
----

== Description

pass:v,q[Upon construction, the predicate saves the current number of uncaught exceptions.]
pass:v,q[This information will be used when calling the predicate to detect if a new]
pass:v,q[exception is being thrown.]
pass:v,q[**Throws:** Nothing.]







[#boost-scope-exception_checker-operator_call]

= Function exception_checker::operator()

pass:v,q[Checks if an exception is being thrown.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/exception_checker.hpp#L80[boost/scope/exception_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-exception_checker-result_type[result_type]
operator()() const noexcept;
----

== Description

pass:v,q[**Throws:** Nothing.]



== Return Value

* `xref:boost-scope-exception_checker-result_type[result_type]` 





[#boost-scope-check_exception]

= Function check_exception

pass:v,q[Creates a predicate for checking whether an exception is being thrown]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/exception_checker.hpp#L96[boost/scope/exception_checker.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-exception_checker[exception_checker]
check_exception() noexcept;
----

== Description

pass:v,q[**Throws:** Nothing.]



== Return Value

* `xref:boost-scope-exception_checker[exception_checker]` 





[#boost-scope-fd_deleter]

= Class fd_deleter

pass:v,q[POSIX-like file descriptor deleter]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/fd_deleter.hpp#L39[boost/scope/fd_deleter.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
struct fd_deleter;
----

==  Types
[,cols=2]
|===
|Name |Description
|xref:boost-scope-fd_deleter-result_type[`pass:v[result_type]`] |

|===
==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-fd_deleter-operator_call[`pass:v[operator()]`] |
pass:v,q[Closes the file descriptor]

|===



[#boost-scope-fd_deleter-result_type]

= fd_deleter::result_type



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/fd_deleter.hpp#L41[boost/scope/fd_deleter.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
typedef void result_type;
----


[#boost-scope-fd_deleter-operator_call]

= Function fd_deleter::operator()

pass:v,q[Closes the file descriptor]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/fd_deleter.hpp#L44[boost/scope/fd_deleter.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-fd_deleter-result_type[result_type]
operator()(int fd) const noexcept;
----


[#boost-scope-fd_resource_traits]

= Class fd_resource_traits

pass:v,q[POSIX-like file descriptor resource traits]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/fd_resource_traits.hpp#L29[boost/scope/fd_resource_traits.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
struct fd_resource_traits;
----

==  Static Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-fd_resource_traits-is_allocated[`pass:v[is_allocated]`] |
pass:v,q[Tests if the fd is allocated (valid)]

|xref:boost-scope-fd_resource_traits-make_default[`pass:v[make_default]`] |
pass:v,q[Creates a default fd value]

|===



[#boost-scope-fd_resource_traits-make_default]

= Function fd_resource_traits::make_default

pass:v,q[Creates a default fd value]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/fd_resource_traits.hpp#L32[boost/scope/fd_resource_traits.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
static
int
make_default() noexcept;
----


[#boost-scope-fd_resource_traits-is_allocated]

= Function fd_resource_traits::is_allocated

pass:v,q[Tests if the fd is allocated (valid)]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/fd_resource_traits.hpp#L38[boost/scope/fd_resource_traits.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
static
bool
is_allocated(int fd) noexcept;
----


[#boost-scope-scope_exit-0a]

= Class scope_exit

pass:v,q[Scope exit guard that conditionally invokes a function upon leaving the scope.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L151[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Func,
    typename Cond = xref:boost-scope-always_true[always_true]>
class scope_exit;
----

==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-scope_exit-0a-active[`pass:v[active]`] |
pass:v,q[Returns] `true` pass:v,q[if the scope guard is active, otherwise] `false.`

|xref:boost-scope-scope_exit-0a-operator_assign[`pass:v[operator=]`] |
|xref:boost-scope-scope_exit-0a-release[`pass:v[release]`] |
pass:v,q[Deactivates the scope guard.]

|xref:boost-scope-scope_exit-0a-2constructor[`pass:v[scope_exit]`] |
|xref:boost-scope-scope_exit-0a-set_active[`pass:v[set_active]`] |
pass:v,q[Activates or deactivates the scope guard.]

|xref:boost-scope-scope_exit-0a-2destructor[`pass:v[~scope_exit]`] |
pass:v,q[If `active() == true`, and invoking the condition function object returns]
`true,`
pass:v,q[invokes]
pass:v,q[the wrapped callable action function object. Destroys the function objects.]

|===

== Description

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

* pass:v,q[A user-defined class with a public `operator()`.]

* pass:v,q[An lvalue reference to such class.]

* pass:v,q[An lvalue reference or pointer to function taking no arguments.]
pass:v,q[The condition function object `operator()` must return a value]
pass:v,q[contextually convertible to]
`true,`
pass:v,q[if the action function object]
pass:v,q[is allowed to be executed, and]
`false`
pass:v,q[otherwise. Additionally,]
pass:v,q[the condition function object `operator()` must not throw, as]
pass:v,q[otherwise the action function object may not be called.]
pass:v,q[The condition function object is optional, and if not specified in]
pass:v,q[template parameters, the scope guard will operate as if the condition]
pass:v,q[always returns]
`true.`
pass:v,q[The scope guard can be in either active or inactive state. By default,]
pass:v,q[the constructed scope guard is active. When active, and condition]
pass:v,q[function object returns]
`true,`
pass:v,q[the scope guard invokes the wrapped]
pass:v,q[action function object on destruction. Otherwise, the scope guard]
pass:v,q[does not call the wrapped action function object.]
pass:v,q[The scope guard can be made inactive by moving-from the scope guard]
pass:v,q[or calling `set_active(false)` or `release()`. An inactive]
pass:v,q[scope guard can be made active by calling `set_active(true)`.]
pass:v,q[If a moved-from scope guard is active on destruction, the behavior]
pass:v,q[is undefined.]




[#boost-scope-scope_exit-0a-2constructor]

= Overload set scope_exit::scope_exit

== Members




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename = enable_if<detail::conjunction<std::is_nothrow_default_constructible<Cond>, std::is_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename detail::move_or_copy_construct_ref<Cond>::type, bool>, detail::is_not_like_scope_exit<F>>::value>::type>
scope_exit(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename detail::move_or_copy_construct_ref<Cond>::type, bool>::value);
  xref:boost-scope-scope_exit-0a-2constructor-027[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C,
    typename = enable_if<detail::conjunction<detail::is_invocable<const C &>, std::is_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename detail::move_or_copy_construct_ref<C, Cond>::type, bool>>::value>::type>
scope_exit(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename detail::move_or_copy_construct_ref<C, Cond>::type, bool>::value);
  xref:boost-scope-scope_exit-0a-2constructor-05[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_constructible<data, typename detail::move_or_copy_construct_ref<Func>::type, typename detail::move_or_copy_construct_ref<Cond>::type, bool>::value,
    typename = enable_if<Requires>::type>
scope_exit(xref:boost-scope-scope_exit-0a[scope_exit]&& that) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<Func>::type, typename detail::move_or_copy_construct_ref<Cond>::type, bool>::value);
  xref:boost-scope-scope_exit-0a-2constructor-0e[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
scope_exit(const xref:boost-scope-scope_exit-0a[scope_exit]&) = delete;
  xref:boost-scope-scope_exit-0a-2constructor-02d[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-scope_exit-0a-operator_assign]

= Overload set scope_exit::operator=

== Members




[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_exit-0a[scope_exit]&
operator=(xref:boost-scope-scope_exit-0a[scope_exit]&&) = delete;
  xref:boost-scope-scope_exit-0a-operator_assign-0b[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_exit-0a[scope_exit]&
operator=(const xref:boost-scope-scope_exit-0a[scope_exit]&) = delete;
  xref:boost-scope-scope_exit-0a-operator_assign-0d[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-scope_exit-0a-2destructor]

= Function scope_exit::~scope_exit

pass:v,q[If `active() == true`, and invoking the condition function object returns]
`true,`
pass:v,q[invokes]
pass:v,q[the wrapped callable action function object. Destroys the function objects.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L444[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
~scope_exit() noexcept(detail::conjunction<detail::is_nothrow_invocable<Func &>, detail::is_nothrow_invocable<Cond &>>::value);
----

== Description

pass:v,q[**Throws:** Nothing, unless invoking a function object throws.]







[#boost-scope-scope_exit-0a-active]

= Function scope_exit::active

pass:v,q[Returns] `true` pass:v,q[if the scope guard is active, otherwise] `false.`


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L463[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
bool
active() const noexcept;
----

== Description

[NOTE]
pass:v,q[This method does not call the condition function object specified on construction.]
pass:v,q[**Throws:** Nothing.]



== Return Value

* `bool` 





[#boost-scope-scope_exit-0a-set_active]

= Function scope_exit::set_active

pass:v,q[Activates or deactivates the scope guard.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L477[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
void
set_active(bool active) noexcept;
----

== Description

pass:v,q[**Throws:** Nothing.]



== Return Value

* `void` 


== Parameters

|===
| Name | Type 

| *active*
| `bool`

|===




[#boost-scope-scope_exit-0a-release]

= Function scope_exit::release

pass:v,q[Deactivates the scope guard.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L491[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
void
release() noexcept;
----

== Description

pass:v,q[**Effects:** As if `set_active(false)`.]
pass:v,q[**Throws:** Nothing.]



== Return Value

* `void` 





[#boost-scope-always_true]

= Class always_true

pass:v,q[A predicate that always returns] `true.`


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L97[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
class always_true;
----

==  Types
[,cols=2]
|===
|Name |Description
|xref:boost-scope-always_true-result_type[`pass:v[result_type]`] |
pass:v,q[Predicate result type]

|===
==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-always_true-operator_call[`pass:v[operator()]`] |
pass:v,q[**Throws:** Nothing.]

|===

== Description

pass:v,q[This predicate can be used as the default condition function object for]
`scope_exit`
pass:v,q[and similar scope guards.]




[#boost-scope-always_true-result_type]

= always_true::result_type

pass:v,q[Predicate result type]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L101[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
typedef bool result_type;
----


[#boost-scope-always_true-operator_call]

= Function always_true::operator()

pass:v,q[**Throws:** Nothing.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L108[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-always_true-result_type[result_type]
operator()() const noexcept;
----


[#boost-scope-scope_exit-05]

= Deduction guide scope_exit



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L499[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename Func>
xref:boost-scope-scope_exit-0a[scope_exit]<Func>(Func) -> xref:boost-scope-scope_exit-0a[scope_exit]<Func>;
----


[#boost-scope-scope_exit-076]

= Deduction guide scope_exit



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L502[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename Func>
xref:boost-scope-scope_exit-0a[scope_exit]<Func>(
    Func,
    bool) -> xref:boost-scope-scope_exit-0a[scope_exit]<Func>;
----


[#boost-scope-scope_exit-07b]

= Deduction guide scope_exit



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L505[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Func,
    typename Cond>
xref:boost-scope-scope_exit-0a[scope_exit]<Func, Cond>(
    Func,
    Cond) -> xref:boost-scope-scope_exit-0a[scope_exit]<Func, Cond>;
----


[#boost-scope-scope_exit-04]

= Deduction guide scope_exit



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L508[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Func,
    typename Cond>
xref:boost-scope-scope_exit-0a[scope_exit]<Func, Cond>(
    Func,
    Cond,
    bool) -> xref:boost-scope-scope_exit-0a[scope_exit]<Func, Cond>;
----


[#boost-scope-make_scope_exit]

= Overload set make_scope_exit

== Members


pass:v,q[Creates a scope guard with a given action function object.]


[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename F>
xref:boost-scope-scope_exit-0a[scope_exit]<decay<F>::type>
make_scope_exit(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_exit<typename std::decay<F>::type>, F, bool>::value);
  xref:boost-scope-make_scope_exit-0d[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C>
enable_if<std::is_constructible<scope_exit<typename std::decay<F>::type, typename std::decay<C>::type>, F, C, bool>::value, xref:boost-scope-scope_exit-0a[scope_exit]<decay<F>::type, decay<C>::type>>::type
make_scope_exit(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_exit<typename std::decay<F>::type, typename std::decay<C>::type>, F, C, bool>::value);
  xref:boost-scope-make_scope_exit-09[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-scope_fail-04]

= Class scope_fail

pass:v,q[Scope exit guard that invokes a function upon leaving the scope with] pass:v,q[a failure condition satisfied.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L72[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Func,
    typename Cond = xref:boost-scope-exception_checker[exception_checker]>
class scope_fail
    : public xref:boost-scope-scope_exit-0a[scope_exit]<Func, Cond>;
----

==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-scope_exit-0a-active[`pass:v[active]`] |
pass:v,q[Returns] `true` pass:v,q[if the scope guard is active, otherwise] `false.`

|xref:boost-scope-scope_exit-0a-operator_assign[`pass:v[operator=]`] |
|xref:boost-scope-scope_exit-0a-release[`pass:v[release]`] |
pass:v,q[Deactivates the scope guard.]

|xref:boost-scope-scope_fail-04-2constructor[`pass:v[scope_fail]`] |
|xref:boost-scope-scope_exit-0a-set_active[`pass:v[set_active]`] |
pass:v,q[Activates or deactivates the scope guard.]

|===

== Description

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

* pass:v,q[A user-defined class with a public `operator()`.]

* pass:v,q[An lvalue reference to such class.]

* pass:v,q[An lvalue reference or pointer to function taking no arguments.]
pass:v,q[The condition function object `operator()` must return a value]
pass:v,q[contextually convertible to]
`true,`
pass:v,q[if the failure is detected and the]
pass:v,q[action function object is allowed to be executed, and]
`false`
pass:v,q[otherwise.]
pass:v,q[Additionally, the failure condition function object `operator()` must not]
pass:v,q[throw, as otherwise the action function object may not be called. If not]
pass:v,q[specified, the default failure condition checks whether the scope is left]
pass:v,q[due to an exception - the action function object will not be called if]
pass:v,q[the scope is left normally.]




[#boost-scope-scope_fail-04-2constructor]

= Overload set scope_fail::scope_fail

== Members




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename = enable_if<detail::conjunction<std::is_constructible<base_type, F, bool>, detail::is_not_like_scope_fail<F>>::value>::type>
scope_fail(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<base_type, F, bool>::value);
  xref:boost-scope-scope_fail-04-2constructor-00[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C,
    typename = enable_if<std::is_constructible<base_type, F, C, bool>::value>::type>
scope_fail(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<base_type, F, C, bool>::value);
  xref:boost-scope-scope_fail-04-2constructor-0c[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_move_constructible<base_type>::value,
    typename = enable_if<Requires>::type>
scope_fail(xref:boost-scope-scope_fail-04[scope_fail]&& that) noexcept(std::is_nothrow_move_constructible<base_type>::value);
  xref:boost-scope-scope_fail-04-2constructor-05[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
scope_fail(const xref:boost-scope-scope_fail-04[scope_fail]&) = delete;
  xref:boost-scope-scope_fail-04-2constructor-0b[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-scope_fail-04-operator_assign]

= Overload set scope_fail::operator=

== Members




[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_fail-04[scope_fail]&
operator=(xref:boost-scope-scope_fail-04[scope_fail]&&) = delete;
  xref:boost-scope-scope_fail-04-operator_assign-0a[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_fail-04[scope_fail]&
operator=(const xref:boost-scope-scope_fail-04[scope_fail]&) = delete;
  xref:boost-scope-scope_fail-04-operator_assign-05[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-scope_fail-0a]

= Deduction guide scope_fail



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L188[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename Func>
xref:boost-scope-scope_fail-04[scope_fail]<Func>(Func) -> xref:boost-scope-scope_fail-04[scope_fail]<Func>;
----


[#boost-scope-scope_fail-09]

= Deduction guide scope_fail



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L191[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename Func>
xref:boost-scope-scope_fail-04[scope_fail]<Func>(
    Func,
    bool) -> xref:boost-scope-scope_fail-04[scope_fail]<Func>;
----


[#boost-scope-scope_fail-08]

= Deduction guide scope_fail



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L198[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Func,
    typename Cond,
    typename = enable_if<detail::is_invocable<const Cond &>::value>::type>
xref:boost-scope-scope_fail-04[scope_fail]<Func, Cond>(
    Func,
    Cond) -> xref:boost-scope-scope_fail-04[scope_fail]<Func, Cond>;
----


[#boost-scope-scope_fail-0c]

= Deduction guide scope_fail



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L205[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Func,
    typename Cond,
    typename = enable_if<detail::is_invocable<const Cond &>::value>::type>
xref:boost-scope-scope_fail-04[scope_fail]<Func, Cond>(
    Func,
    Cond,
    bool) -> xref:boost-scope-scope_fail-04[scope_fail]<Func, Cond>;
----


[#boost-scope-make_scope_fail]

= Overload set make_scope_fail

== Members


pass:v,q[Creates a scope fail guard with a given action function object.]


[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename F>
xref:boost-scope-scope_fail-04[scope_fail]<decay<F>::type>
make_scope_fail(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_fail<typename std::decay<F>::type>, F, bool>::value);
  xref:boost-scope-make_scope_fail-07[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C>
enable_if<detail::is_invocable<const C &>::value, xref:boost-scope-scope_fail-04[scope_fail]<decay<F>::type, decay<C>::type>>::type
make_scope_fail(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_fail<typename std::decay<F>::type, typename std::decay<C>::type>, F, C, bool>::value);
  xref:boost-scope-make_scope_fail-0e[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-scope_final-00]

= Class scope_final

pass:v,q[Scope final guard that invokes a function upon leaving the scope.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_final.hpp#L57[boost/scope/scope_final.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename Func>
class scope_final;
----

==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-scope_final-00-operator_assign[`pass:v[operator=]`] |

|xref:boost-scope-scope_final-00-2constructor[`pass:v[scope_final]`] |
|xref:boost-scope-scope_final-00-2destructor[`pass:v[~scope_final]`] |
pass:v,q[Invokes the wrapped callable function object and destroys the callable.]

|===

== Description

pass:v,q[The scope guard wraps a function object callable with no arguments] pass:v,q[that can be one of:]

* pass:v,q[A user-defined class with a public `operator()`.]

* pass:v,q[An lvalue reference to such class.]

* pass:v,q[An lvalue reference or pointer to function taking no arguments.]
pass:v,q[The scope final guard unconditionally invokes the wrapped function object]
pass:v,q[on destruction.]




[#boost-scope-scope_final-00-2constructor]

= Overload set scope_final::scope_final

== Members




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename = enable_if<detail::conjunction<std::is_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename std::is_nothrow_constructible<Func, typename detail::move_or_copy_construct_ref<F, Func>::type>::type>, detail::is_not_like_scope_final<F>>::value>::type>
scope_final(F&& func) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename std::is_nothrow_constructible<Func, typename detail::move_or_copy_construct_ref<F, Func>::type>::type>::value);
  xref:boost-scope-scope_final-00-2constructor-08[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
scope_final(const xref:boost-scope-scope_final-00[scope_final]&) = delete;
  xref:boost-scope-scope_final-00-2constructor-00[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-scope_final-00-operator_assign]

= Function scope_final::operator=



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_final.hpp#L130[boost/scope/scope_final.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_final-00[scope_final]&
operator=(const xref:boost-scope-scope_final-00[scope_final]&) = delete;
----


[#boost-scope-scope_final-00-2destructor]

= Function scope_final::~scope_final

pass:v,q[Invokes the wrapped callable function object and destroys the callable.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_final.hpp#L137[boost/scope/scope_final.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
~scope_final() noexcept(detail::is_nothrow_invocable<Func &>::value);
----

== Description

pass:v,q[**Throws:** Nothing, unless invoking the callable throws.]







[#boost-scope-scope_final-08]

= Deduction guide scope_final



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_final.hpp#L145[boost/scope/scope_final.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename Func>
xref:boost-scope-scope_final-00[scope_final]<Func>(Func) -> xref:boost-scope-scope_final-00[scope_final]<Func>;
----


[#boost-scope-scope_success-0ec]

= Class scope_success

pass:v,q[Scope exit guard that invokes a function upon leaving the scope with] pass:v,q[a failure condition not satisfied.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L116[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Func,
    typename Cond = xref:boost-scope-exception_checker[exception_checker]>
class scope_success
    : public xref:boost-scope-scope_exit-0a[scope_exit]<Func, logical_not<Cond>>;
----

==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-scope_exit-0a-active[`pass:v[active]`] |
pass:v,q[Returns] `true` pass:v,q[if the scope guard is active, otherwise] `false.`

|xref:boost-scope-scope_exit-0a-operator_assign[`pass:v[operator=]`] |
|xref:boost-scope-scope_exit-0a-release[`pass:v[release]`] |
pass:v,q[Deactivates the scope guard.]

|xref:boost-scope-scope_success-0ec-2constructor[`pass:v[scope_success]`] |
|xref:boost-scope-scope_exit-0a-set_active[`pass:v[set_active]`] |
pass:v,q[Activates or deactivates the scope guard.]

|===

== Description

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

* pass:v,q[A user-defined class with a public `operator()`.]

* pass:v,q[An lvalue reference to such class.]

* pass:v,q[An lvalue reference or pointer to function taking no arguments.]
pass:v,q[The condition function object `operator()` must return a value]
pass:v,q[contextually convertible to]
`true,`
pass:v,q[if the failure is detected and the]
pass:v,q[action function object is not allowed to be executed, and]
`false`
pass:v,q[otherwise.]
pass:v,q[Additionally, the failure condition function object `operator()` must not]
pass:v,q[throw, as otherwise the action function object may not be called. If not]
pass:v,q[specified, the default failure condition checks whether the scope is left]
pass:v,q[due to an exception - the action function object will only be called if]
pass:v,q[the scope is left normally.]




[#boost-scope-scope_success-0ec-2constructor]

= Overload set scope_success::scope_success

== Members




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename = enable_if<detail::conjunction<std::is_constructible<base_type, F, bool>, detail::is_not_like_scope_success<F>>::value>::type>
scope_success(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<base_type, F, bool>::value);
  xref:boost-scope-scope_success-0ec-2constructor-0b[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C,
    typename = enable_if<std::is_constructible<base_type, F, C, bool>::value>::type>
scope_success(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<base_type, F, C, bool>::value);
  xref:boost-scope-scope_success-0ec-2constructor-0d[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_move_constructible<base_type>::value,
    typename = enable_if<Requires>::type>
scope_success(xref:boost-scope-scope_success-0ec[scope_success]&& that) noexcept(std::is_nothrow_move_constructible<base_type>::value);
  xref:boost-scope-scope_success-0ec-2constructor-027[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
scope_success(const xref:boost-scope-scope_success-0ec[scope_success]&) = delete;
  xref:boost-scope-scope_success-0ec-2constructor-02c[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-scope_success-0ec-operator_assign]

= Overload set scope_success::operator=

== Members




[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_success-0ec[scope_success]&
operator=(xref:boost-scope-scope_success-0ec[scope_success]&&) = delete;
  xref:boost-scope-scope_success-0ec-operator_assign-07[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_success-0ec[scope_success]&
operator=(const xref:boost-scope-scope_success-0ec[scope_success]&) = delete;
  xref:boost-scope-scope_success-0ec-operator_assign-0f[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-scope_success-0c]

= Deduction guide scope_success



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L232[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename Func>
xref:boost-scope-scope_success-0ec[scope_success]<Func>(Func) -> xref:boost-scope-scope_success-0ec[scope_success]<Func>;
----


[#boost-scope-scope_success-0ef]

= Deduction guide scope_success



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L235[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename Func>
xref:boost-scope-scope_success-0ec[scope_success]<Func>(
    Func,
    bool) -> xref:boost-scope-scope_success-0ec[scope_success]<Func>;
----


[#boost-scope-scope_success-08b]

= Deduction guide scope_success



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L242[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Func,
    typename Cond,
    typename = enable_if<detail::is_invocable<const Cond &>::value>::type>
xref:boost-scope-scope_success-0ec[scope_success]<Func, Cond>(
    Func,
    Cond) -> xref:boost-scope-scope_success-0ec[scope_success]<Func, Cond>;
----


[#boost-scope-scope_success-08c]

= Deduction guide scope_success



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L249[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Func,
    typename Cond,
    typename = enable_if<detail::is_invocable<const Cond &>::value>::type>
xref:boost-scope-scope_success-0ec[scope_success]<Func, Cond>(
    Func,
    Cond,
    bool) -> xref:boost-scope-scope_success-0ec[scope_success]<Func, Cond>;
----


[#boost-scope-make_scope_success]

= Overload set make_scope_success

== Members


pass:v,q[Creates a scope fail guard with a given action function object.]


[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename F>
xref:boost-scope-scope_success-0ec[scope_success]<decay<F>::type>
make_scope_success(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_success<typename std::decay<F>::type>, F, bool>::value);
  xref:boost-scope-make_scope_success-0c[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C>
enable_if<detail::is_invocable<const C &>::value, xref:boost-scope-scope_success-0ec[scope_success]<decay<F>::type, decay<C>::type>>::type
make_scope_success(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_success<typename std::decay<F>::type, typename std::decay<C>::type>, F, C, bool>::value);
  xref:boost-scope-make_scope_success-0b[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-unique_resource-0c]

= Class unique_resource

pass:v,q[RAII wrapper for automatically reclaiming arbitrary resources.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1051[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Resource,
    typename Deleter,
    typename Traits = void>
class unique_resource;
----

==  Types
[,cols=2]
|===
|Name |Description
|xref:boost-scope-unique_resource-0c-deleter_type[`pass:v[deleter_type]`] |
pass:v,q[Deleter type]

|xref:boost-scope-unique_resource-0c-resource_type[`pass:v[resource_type]`] |
pass:v,q[Resource type]

|xref:boost-scope-unique_resource-0c-traits_type[`pass:v[traits_type]`] |
pass:v,q[Resource traits]

|===
==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost-scope-unique_resource-0c-allocated[`pass:v[allocated]`] |
pass:v,q[Returns] `true` pass:v,q[if the resource is allocated and to be reclaimed by the deleter, otherwise]
`false.`

|xref:boost-scope-unique_resource-0c-get[`pass:v[get]`] |
pass:v,q[Returns a reference to the resource object.]

|xref:boost-scope-unique_resource-0c-get_deleter[`pass:v[get_deleter]`] |
pass:v,q[Returns a reference to the deleter object.]

|xref:boost-scope-unique_resource-0c-operator_star[`pass:v[operator*]`] |

|xref:boost-scope-unique_resource-0c-operator_ptr[`pass:v[operator->]`] |

|xref:boost-scope-unique_resource-0c-operator_assign[`pass:v[operator=]`] |
|xref:boost-scope-unique_resource-0c-release[`pass:v[release]`] |
pass:v,q[Marks the resource as unallocated. Does not call the deleter if the resource was previously allocated.]

|xref:boost-scope-unique_resource-0c-reset[`pass:v[reset]`] |
pass:v,q[If the resource is allocated, calls the deleter function on it and marks the resource as unallocated.]

|xref:boost-scope-unique_resource-0c-swap[`pass:v[swap]`] |

|xref:boost-scope-unique_resource-0c-2constructor[`pass:v[unique_resource]`] |
|xref:boost-scope-unique_resource-0c-2destructor[`pass:v[~unique_resource]`] |
pass:v,q[Invokes `reset()` and destroys the resource.]

|===
==  Friends
[,cols=2]
|===
|Name |Description
|xref:boost-scope-unique_resource-0c-08friend[`pass:v[swap]`] |

|===

== Description

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

* pass:v,q[Move-constructible, where the move constructor is marked as `noexcept`, or]

* pass:v,q[Copy-constructible, or]

* pass:v,q[An lvalue reference to an object type.]
pass:v,q[The deleter must be a function object type that is callable on an lvalue]
pass:v,q[of the resource type. The deleter must be copy-constructible.]
pass:v,q[An optional resource traits template parameter may be specified. Resource]
pass:v,q[traits can be used to optimize]
`unique_resource`
pass:v,q[implementation when]
pass:v,q[the following conditions are met:]

* pass:v,q[There is at least one value of the resource type that is considered]
pass:v,q[unallocated (that is, no allocated resource shall be equal to one of]
pass:v,q[the unallocated resource values). The unallocated resource values need not]
pass:v,q[be deallocated using the deleter.]

* pass:v,q[One of the unallocated resource values can be considered the default.]
pass:v,q[Constructing the default resource value and assigning it to a resource]
pass:v,q[object (whether allocated or not) shall not throw exceptions.]

* pass:v,q[Resource objects can be tested for being unallocated. Such a test shall]
pass:v,q[not throw exceptions.]
pass:v,q[If specified, the resource traits must be a class that has the following]
pass:v,q[public static members:]

* pass:v,q[`Resource make_default() noexcept` - must return the default resource]
pass:v,q[value.]

* pass:v,q[`bool is_allocated(Resource const]
pass:v,q[&]
pass:v,q[res) noexcept` - must]
pass:v,q[return]
`true`
pass:v,q[if]
`res`
pass:v,q[is not one of the unallocated resource values]
pass:v,q[and]
`false`
pass:v,q[otherwise.]
pass:v,q[Note that `is_allocated(make_default())` must always return]
`false.`
pass:v,q[When conforming resource traits are specified,]
`unique_resource`
pass:v,q[will be able]
pass:v,q[to avoid storing additional indication of whether the owned resource object]
pass:v,q[needs to be deallocated with the deleter on destruction. It will use the default]
pass:v,q[resource value to initialize the owned resource object when]
`unique_resource`
pass:v,q[is not in the allocated state. Additionally, it will be possible to construct]
`unique_resource`
pass:v,q[with unallocated resource values, which will create]
`unique_resource`
pass:v,q[objects in deallocated state (the deleter will not be called]
pass:v,q[on unallocated resource values).]




[#boost-scope-unique_resource-0c-resource_type]

= unique_resource::resource_type

pass:v,q[Resource type]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1055[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
typedef Resource resource_type;
----


[#boost-scope-unique_resource-0c-deleter_type]

= unique_resource::deleter_type

pass:v,q[Deleter type]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1057[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
typedef Deleter deleter_type;
----


[#boost-scope-unique_resource-0c-traits_type]

= unique_resource::traits_type

pass:v,q[Resource traits]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1059[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
typedef Traits traits_type;
----


[#boost-scope-unique_resource-0c-2constructor]

= Overload set unique_resource::unique_resource

== Members




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_default_constructible<data>::value,
    typename = enable_if<Requires>::type>
constexpr
unique_resource() noexcept(std::is_nothrow_default_constructible<data>::value);
  xref:boost-scope-unique_resource-0c-2constructor-0d5[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename D,
    typename = enable_if<std::is_constructible<data, default_resource_t, typename detail::move_or_copy_construct_ref<D, deleter_type>::type>::value>::type>
unique_resource(
    xref:boost-scope-default_resource_t[default_resource_t] res,
    D&& del) noexcept(std::is_nothrow_constructible<data, default_resource_t, typename detail::move_or_copy_construct_ref<D, deleter_type>::type>::value);
  xref:boost-scope-unique_resource-0c-2constructor-0d0[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename R,
    typename = enable_if<detail::conjunction<std::is_nothrow_default_constructible<deleter_type>, std::is_constructible<data, typename detail::move_or_copy_construct_ref<R, resource_type>::type, typename detail::move_or_copy_construct_ref<deleter_type>::type>, detail::disjunction<detail::negation<std::is_reference<resource_type>>, std::is_reference<R>>>::value>::type>
unique_resource(R&& res) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<R, resource_type>::type, typename detail::move_or_copy_construct_ref<deleter_type>::type>::value);
  xref:boost-scope-unique_resource-0c-2constructor-0d4[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename R,
    typename D,
    typename = enable_if<detail::conjunction<std::is_constructible<data, typename detail::move_or_copy_construct_ref<R, resource_type>::type, typename detail::move_or_copy_construct_ref<D, deleter_type>::type>, detail::disjunction<detail::negation<std::is_reference<resource_type>>, std::is_reference<R>>>::value>::type>
unique_resource(
    R&& res,
    D&& del) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<R, resource_type>::type, typename detail::move_or_copy_construct_ref<D, deleter_type>::type>::value);
  xref:boost-scope-unique_resource-0c-2constructor-05[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
unique_resource(const xref:boost-scope-unique_resource-0c[unique_resource]&) = delete;
  xref:boost-scope-unique_resource-0c-2constructor-00[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_move_constructible<data>::value,
    typename = enable_if<Requires>::type>
unique_resource(xref:boost-scope-unique_resource-0c[unique_resource]&& that) noexcept(std::is_nothrow_move_constructible<data>::value);
  xref:boost-scope-unique_resource-0c-2constructor-08[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-unique_resource-0c-operator_assign]

= Overload set unique_resource::operator=

== Members




[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-unique_resource-0c[unique_resource]&
operator=(const xref:boost-scope-unique_resource-0c[unique_resource]&) = delete;
  xref:boost-scope-unique_resource-0c-operator_assign-08[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<bool Requires = std::is_move_assignable<data>::value>
enable_if<Requires, xref:boost-scope-unique_resource-0c[unique_resource]&>::type
operator=(xref:boost-scope-unique_resource-0c[unique_resource]&& that) noexcept(std::is_nothrow_move_assignable<data>::value);
  xref:boost-scope-unique_resource-0c-operator_assign-0d[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-unique_resource-0c-2destructor]

= Function unique_resource::~unique_resource

pass:v,q[Invokes `reset()` and destroys the resource.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1296[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
~unique_resource() noexcept(detail::is_nothrow_invocable<deleter_type &, resource_type &>::value);
----

== Description

pass:v,q[**Throws:** Nothing, unless invoking the deleter throws.]







[#boost-scope-unique_resource-0c-allocated]

= Function unique_resource::allocated

pass:v,q[Returns] `true` pass:v,q[if the resource is allocated and to be reclaimed by the deleter, otherwise]
`false.`


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1306[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
bool
allocated() const noexcept;
----

== Description

pass:v,q[**Throws:** Nothing.]



== Return Value

* `bool` 





[#boost-scope-unique_resource-0c-get]

= Function unique_resource::get

pass:v,q[Returns a reference to the resource object.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1316[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
const xref:boost-scope-unique_resource-0c-resource_type[resource_type]&
get() const noexcept;
----

== Description

pass:v,q[**Throws:** Nothing.]



== Return Value

* `const xref:boost-scope-unique_resource-0c-resource_type[resource_type]&` 





[#boost-scope-unique_resource-0c-get_deleter]

= Function unique_resource::get_deleter

pass:v,q[Returns a reference to the deleter object.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1326[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
const xref:boost-scope-unique_resource-0c-deleter_type[deleter_type]&
get_deleter() const noexcept;
----

== Description

pass:v,q[**Throws:** Nothing.]



== Return Value

* `const xref:boost-scope-unique_resource-0c-deleter_type[deleter_type]&` 





[#boost-scope-unique_resource-0c-release]

= Function unique_resource::release

pass:v,q[Marks the resource as unallocated. Does not call the deleter if the resource was previously allocated.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1338[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
void
release() noexcept;
----

== Description

pass:v,q[**Throws:** Nothing.]



== Return Value

* `void` 





[#boost-scope-unique_resource-0c-reset]

= Overload set unique_resource::reset

== Members


pass:v,q[If the resource is allocated, calls the deleter function on it and marks the resource as unallocated.]


[source,cpp,subs="verbatim,macros,-callouts"]
----
void
reset() noexcept(detail::is_nothrow_invocable<deleter_type &, resource_type &>::value);
  xref:boost-scope-unique_resource-0c-reset-05[pass:c,q,m[*_» more..._*]]
----




[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename R>
enable_if<detail::conjunction<std::is_assignable<internal_resource_type &, typename detail::move_or_copy_assign_ref<R, resource_type>::type>, detail::disjunction<detail::negation<std::is_reference<resource_type>>, std::is_reference<R>>>::value>::type
reset(R&& res) noexcept(detail::conjunction<detail::is_nothrow_invocable<deleter_type &, resource_type &>, std::is_nothrow_assignable<internal_resource_type &, typename detail::move_or_copy_assign_ref<R, resource_type>::type>>::value);
  xref:boost-scope-unique_resource-0c-reset-0f[pass:c,q,m[*_» more..._*]]
----


[#boost-scope-unique_resource-0c-operator_ptr]

= Function unique_resource::operator->



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1417[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<bool Requires = detail::is_dereferenceable<resource_type>::value>
enable_if<Requires, const xref:boost-scope-unique_resource-0c-resource_type[resource_type]&>::type
operator->() const noexcept;
----


[#boost-scope-unique_resource-0c-operator_star]

= Function unique_resource::operator*



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1437[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<bool Requires = detail::is_dereferenceable<resource_type>::value>
dereference_traits<xref:boost-scope-unique_resource-0c-resource_type[resource_type], Requires>::result_type
operator*() const noexcept(detail::dereference_traits<resource_type, Requires>::is_noexcept);
----


[#boost-scope-unique_resource-0c-swap]

= Function unique_resource::swap



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1463[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<bool Requires = detail::is_swappable<data>::value>
enable_if<Requires>::type
swap(xref:boost-scope-unique_resource-0c[unique_resource]& that) noexcept(detail::is_nothrow_swappable<data>::value);
----


[#boost-scope-unique_resource-0c-08friend]

= Friend swap



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1479[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<bool Requires = detail::is_swappable<data>::value>
friend
enable_if<Requires>::type
swap(
    xref:boost-scope-unique_resource-0c[unique_resource]& left,
    xref:boost-scope-unique_resource-0c[unique_resource]& right) noexcept(detail::is_nothrow_swappable<data>::value);
----


[#boost-scope-make_unique_resource_checked]

= Function make_unique_resource_checked

pass:v,q[Checks if the resource is valid and creates a] `unique_resource` pass:v,q[wrapper.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource_fwd.hpp#L34[boost/scope/unique_resource_fwd.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Resource,
    typename Deleter,
    typename Invalid = decay<Resource>::type>
xref:boost-scope-unique_resource-0c[unique_resource]<decay<Resource>::type, decay<Deleter>::type>
make_unique_resource_checked(
    Resource&& res,
    const Invalid& invalid,
    Deleter&& del) noexcept(detail::conjunction<std::is_nothrow_constructible<typename std::decay<Resource>::type, typename detail::move_or_copy_construct_ref<Resource, typename std::decay<Resource>::type>::type>, std::is_nothrow_constructible<typename std::decay<Deleter>::type, typename detail::move_or_copy_construct_ref<Deleter, typename std::decay<Deleter>::type>::type>>::value);
----

== Description

pass:v,q[**Effects:** If the resource] _res_ pass:v,q[is not equal to] _invalid,_
pass:v,q[creates a unique resource wrapper]
pass:v,q[that is in allocated state and owns]
_res._
pass:v,q[Otherwise creates a unique resource wrapper]
pass:v,q[in deallocated state.]
[NOTE]
pass:v,q[This function does not call]
_del_
pass:v,q[if]
_res_
pass:v,q[is equal to]
_invalid._
pass:v,q[**Throws:** Nothing, unless]
`unique_resource`
pass:v,q[constructor throws.]



== Return Value

* `xref:boost-scope-unique_resource-0c[unique_resource]<decay<Resource>::type, decay<Deleter>::type>` 


== Parameters

|===
| Name | Type 

| *res*
| `Resource&&`

| *invalid*
| `const Invalid&`

| *del*
| `Deleter&&`

|===




[#boost-scope-default_resource_t]

= Class default_resource_t



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L40[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
struct default_resource_t;
----




[#boost-scope-default_resource]

= default_resource

pass:v,q[Keyword representing default, unallocated resource argument]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L43[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
constexpr
const xref:boost-scope-default_resource_t[default_resource_t] default_resource;
----


[#boost-scope-swap]

= Function swap



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1480[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<bool Requires = detail::is_swappable<data>::value>
enable_if<Requires>::type
swap(
    xref:boost-scope-unique_resource-0c[unique_resource]& left,
    xref:boost-scope-unique_resource-0c[unique_resource]& right) noexcept(detail::is_nothrow_swappable<data>::value);
----


[#boost-scope-unique_resource-07]

= Deduction guide unique_resource



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1524[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Resource,
    typename Deleter,
    typename = enable_if<!detail::is_default_resource<Resource>::value>::type>
xref:boost-scope-unique_resource-0c[unique_resource]<Resource, Deleter>(
    Resource,
    Deleter) -> xref:boost-scope-unique_resource-0c[unique_resource]<Resource, Deleter>;
----


[#boost-scope-unique_fd]

= unique_fd

pass:v,q[Unique POSIX-like file descriptor resource]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_fd.hpp#L31[boost/scope/unique_fd.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
typedef xref:boost-scope-unique_resource-0c[unique_resource]<int, xref:boost-scope-fd_deleter[fd_deleter], xref:boost-scope-fd_resource_traits[fd_resource_traits]> unique_fd;
----


[#boost-scope-scope_exit-0a-operator_assign-0b]

= Function scope_exit::operator=



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L433[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_exit-0a[scope_exit]&
operator=(xref:boost-scope-scope_exit-0a[scope_exit]&&) = delete;
----


[#boost-scope-scope_exit-0a-operator_assign-0d]

= Function scope_exit::operator=



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L436[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_exit-0a[scope_exit]&
operator=(const xref:boost-scope-scope_exit-0a[scope_exit]&) = delete;
----


[#boost-scope-scope_fail-04-operator_assign-0a]

= Function scope_fail::operator=



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L180[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_fail-04[scope_fail]&
operator=(xref:boost-scope-scope_fail-04[scope_fail]&&) = delete;
----


[#boost-scope-scope_fail-04-operator_assign-05]

= Function scope_fail::operator=



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L183[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_fail-04[scope_fail]&
operator=(const xref:boost-scope-scope_fail-04[scope_fail]&) = delete;
----


[#boost-scope-scope_exit-0a-2constructor-027]

= Function scope_exit::scope_exit



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L309[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename = enable_if<detail::conjunction<std::is_nothrow_default_constructible<Cond>, std::is_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename detail::move_or_copy_construct_ref<Cond>::type, bool>, detail::is_not_like_scope_exit<F>>::value>::type>
scope_exit(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename detail::move_or_copy_construct_ref<Cond>::type, bool>::value);
----


[#boost-scope-scope_exit-0a-2constructor-05]

= Function scope_exit::scope_exit



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L363[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C,
    typename = enable_if<detail::conjunction<detail::is_invocable<const C &>, std::is_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename detail::move_or_copy_construct_ref<C, Cond>::type, bool>>::value>::type>
scope_exit(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename detail::move_or_copy_construct_ref<C, Cond>::type, bool>::value);
----


[#boost-scope-scope_exit-0a-2constructor-0e]

= Function scope_exit::scope_exit



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L415[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_constructible<data, typename detail::move_or_copy_construct_ref<Func>::type, typename detail::move_or_copy_construct_ref<Cond>::type, bool>::value,
    typename = enable_if<Requires>::type>
scope_exit(xref:boost-scope-scope_exit-0a[scope_exit]&& that) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<Func>::type, typename detail::move_or_copy_construct_ref<Cond>::type, bool>::value);
----


[#boost-scope-scope_exit-0a-2constructor-02d]

= Function scope_exit::scope_exit



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L435[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
scope_exit(const xref:boost-scope-scope_exit-0a[scope_exit]&) = delete;
----


[#boost-scope-scope_final-00-2constructor-08]

= Function scope_final::scope_final



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_final.hpp#L113[boost/scope/scope_final.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename = enable_if<detail::conjunction<std::is_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename std::is_nothrow_constructible<Func, typename detail::move_or_copy_construct_ref<F, Func>::type>::type>, detail::is_not_like_scope_final<F>>::value>::type>
scope_final(F&& func) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<F, Func>::type, typename std::is_nothrow_constructible<Func, typename detail::move_or_copy_construct_ref<F, Func>::type>::type>::value);
----


[#boost-scope-scope_final-00-2constructor-00]

= Function scope_final::scope_final



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_final.hpp#L129[boost/scope/scope_final.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
scope_final(const xref:boost-scope-scope_final-00[scope_final]&) = delete;
----


[#boost-scope-make_scope_exit-0d]

= Function make_scope_exit

pass:v,q[Creates a scope guard with a given action function object.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L521[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename F>
xref:boost-scope-scope_exit-0a[scope_exit]<decay<F>::type>
make_scope_exit(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_exit<typename std::decay<F>::type>, F, bool>::value);
----

== Description

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



== Return Value

* `xref:boost-scope-scope_exit-0a[scope_exit]<decay<F>::type>` 


== Parameters

|===
| Name | Type 

| *func*
| `F&&`

| *active*
| `bool`

|===




[#boost-scope-make_scope_exit-09]

= Function make_scope_exit



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L543[boost/scope/scope_exit.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C>
enable_if<std::is_constructible<scope_exit<typename std::decay<F>::type, typename std::decay<C>::type>, F, C, bool>::value, xref:boost-scope-scope_exit-0a[scope_exit]<decay<F>::type, decay<C>::type>>::type
make_scope_exit(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_exit<typename std::decay<F>::type, typename std::decay<C>::type>, F, C, bool>::value);
----


[#boost-scope-scope_fail-04-2constructor-00]

= Function scope_fail::scope_fail



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L105[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename = enable_if<detail::conjunction<std::is_constructible<base_type, F, bool>, detail::is_not_like_scope_fail<F>>::value>::type>
scope_fail(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<base_type, F, bool>::value);
----


[#boost-scope-scope_fail-04-2constructor-0c]

= Function scope_fail::scope_fail



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L139[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C,
    typename = enable_if<std::is_constructible<base_type, F, C, bool>::value>::type>
scope_fail(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<base_type, F, C, bool>::value);
----


[#boost-scope-scope_fail-04-2constructor-05]

= Function scope_fail::scope_fail



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L174[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_move_constructible<base_type>::value,
    typename = enable_if<Requires>::type>
scope_fail(xref:boost-scope-scope_fail-04[scope_fail]&& that) noexcept(std::is_nothrow_move_constructible<base_type>::value);
----


[#boost-scope-scope_fail-04-2constructor-0b]

= Function scope_fail::scope_fail



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L182[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
scope_fail(const xref:boost-scope-scope_fail-04[scope_fail]&) = delete;
----


[#boost-scope-scope_success-0ec-operator_assign-07]

= Function scope_success::operator=



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L224[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_success-0ec[scope_success]&
operator=(xref:boost-scope-scope_success-0ec[scope_success]&&) = delete;
----


[#boost-scope-scope_success-0ec-operator_assign-0f]

= Function scope_success::operator=



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L227[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-scope_success-0ec[scope_success]&
operator=(const xref:boost-scope-scope_success-0ec[scope_success]&) = delete;
----


[#boost-scope-make_scope_fail-07]

= Function make_scope_fail

pass:v,q[Creates a scope fail guard with a given action function object.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L218[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename F>
xref:boost-scope-scope_fail-04[scope_fail]<decay<F>::type>
make_scope_fail(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_fail<typename std::decay<F>::type>, F, bool>::value);
----

== Description

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



== Return Value

* `xref:boost-scope-scope_fail-04[scope_fail]<decay<F>::type>` 


== Parameters

|===
| Name | Type 

| *func*
| `F&&`

| *active*
| `bool`

|===




[#boost-scope-make_scope_fail-0e]

= Function make_scope_fail



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_fail.hpp#L240[boost/scope/scope_fail.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C>
enable_if<detail::is_invocable<const C &>::value, xref:boost-scope-scope_fail-04[scope_fail]<decay<F>::type, decay<C>::type>>::type
make_scope_fail(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_fail<typename std::decay<F>::type, typename std::decay<C>::type>, F, C, bool>::value);
----


[#boost-scope-unique_resource-0c-reset-05]

= Function unique_resource::reset

pass:v,q[If the resource is allocated, calls the deleter function on it and marks the resource as unallocated.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1350[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
void
reset() noexcept(detail::is_nothrow_invocable<deleter_type &, resource_type &>::value);
----

== Description

pass:v,q[**Throws:** Nothing, unless invoking the deleter throws.]



== Return Value

* `void` 





[#boost-scope-unique_resource-0c-reset-0f]

= Function unique_resource::reset



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1377[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename R>
enable_if<detail::conjunction<std::is_assignable<internal_resource_type &, typename detail::move_or_copy_assign_ref<R, resource_type>::type>, detail::disjunction<detail::negation<std::is_reference<resource_type>>, std::is_reference<R>>>::value>::type
reset(R&& res) noexcept(detail::conjunction<detail::is_nothrow_invocable<deleter_type &, resource_type &>, std::is_nothrow_assignable<internal_resource_type &, typename detail::move_or_copy_assign_ref<R, resource_type>::type>>::value);
----


[#boost-scope-unique_resource-0c-operator_assign-08]

= Function unique_resource::operator=



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1220[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost-scope-unique_resource-0c[unique_resource]&
operator=(const xref:boost-scope-unique_resource-0c[unique_resource]&) = delete;
----


[#boost-scope-unique_resource-0c-operator_assign-0d]

= Function unique_resource::operator=



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1279[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<bool Requires = std::is_move_assignable<data>::value>
enable_if<Requires, xref:boost-scope-unique_resource-0c[unique_resource]&>::type
operator=(xref:boost-scope-unique_resource-0c[unique_resource]&& that) noexcept(std::is_nothrow_move_assignable<data>::value);
----


[#boost-scope-scope_success-0ec-2constructor-0b]

= Function scope_success::scope_success



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L149[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename = enable_if<detail::conjunction<std::is_constructible<base_type, F, bool>, detail::is_not_like_scope_success<F>>::value>::type>
scope_success(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<base_type, F, bool>::value);
----


[#boost-scope-scope_success-0ec-2constructor-0d]

= Function scope_success::scope_success



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L183[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C,
    typename = enable_if<std::is_constructible<base_type, F, C, bool>::value>::type>
scope_success(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<base_type, F, C, bool>::value);
----


[#boost-scope-scope_success-0ec-2constructor-027]

= Function scope_success::scope_success



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L218[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_move_constructible<base_type>::value,
    typename = enable_if<Requires>::type>
scope_success(xref:boost-scope-scope_success-0ec[scope_success]&& that) noexcept(std::is_nothrow_move_constructible<base_type>::value);
----


[#boost-scope-scope_success-0ec-2constructor-02c]

= Function scope_success::scope_success



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L226[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
scope_success(const xref:boost-scope-scope_success-0ec[scope_success]&) = delete;
----


[#boost-scope-make_scope_success-0c]

= Function make_scope_success

pass:v,q[Creates a scope fail guard with a given action function object.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L262[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<typename F>
xref:boost-scope-scope_success-0ec[scope_success]<decay<F>::type>
make_scope_success(
    F&& func,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_success<typename std::decay<F>::type>, F, bool>::value);
----

== Description

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



== Return Value

* `xref:boost-scope-scope_success-0ec[scope_success]<decay<F>::type>` 


== Parameters

|===
| Name | Type 

| *func*
| `F&&`

| *active*
| `bool`

|===




[#boost-scope-make_scope_success-0b]

= Function make_scope_success



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_success.hpp#L284[boost/scope/scope_success.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename F,
    typename C>
enable_if<detail::is_invocable<const C &>::value, xref:boost-scope-scope_success-0ec[scope_success]<decay<F>::type, decay<C>::type>>::type
make_scope_success(
    F&& func,
    C&& cond,
    bool active = true) noexcept(std::is_nothrow_constructible<scope_success<typename std::decay<F>::type, typename std::decay<C>::type>, F, C, bool>::value);
----


[#boost-scope-unique_resource-0c-2constructor-0d5]

= Function unique_resource::unique_resource



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1089[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_default_constructible<data>::value,
    typename = enable_if<Requires>::type>
constexpr
unique_resource() noexcept(std::is_nothrow_default_constructible<data>::value);
----


[#boost-scope-unique_resource-0c-2constructor-0d0]

= Function unique_resource::unique_resource



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1117[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename D,
    typename = enable_if<std::is_constructible<data, default_resource_t, typename detail::move_or_copy_construct_ref<D, deleter_type>::type>::value>::type>
unique_resource(
    xref:boost-scope-default_resource_t[default_resource_t] res,
    D&& del) noexcept(std::is_nothrow_constructible<data, default_resource_t, typename detail::move_or_copy_construct_ref<D, deleter_type>::type>::value);
----


[#boost-scope-unique_resource-0c-2constructor-0d4]

= Function unique_resource::unique_resource



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1155[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename R,
    typename = enable_if<detail::conjunction<std::is_nothrow_default_constructible<deleter_type>, std::is_constructible<data, typename detail::move_or_copy_construct_ref<R, resource_type>::type, typename detail::move_or_copy_construct_ref<deleter_type>::type>, detail::disjunction<detail::negation<std::is_reference<resource_type>>, std::is_reference<R>>>::value>::type>
unique_resource(R&& res) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<R, resource_type>::type, typename detail::move_or_copy_construct_ref<deleter_type>::type>::value);
----


[#boost-scope-unique_resource-0c-2constructor-05]

= Function unique_resource::unique_resource



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1203[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename R,
    typename D,
    typename = enable_if<detail::conjunction<std::is_constructible<data, typename detail::move_or_copy_construct_ref<R, resource_type>::type, typename detail::move_or_copy_construct_ref<D, deleter_type>::type>, detail::disjunction<detail::negation<std::is_reference<resource_type>>, std::is_reference<R>>>::value>::type>
unique_resource(
    R&& res,
    D&& del) noexcept(std::is_nothrow_constructible<data, typename detail::move_or_copy_construct_ref<R, resource_type>::type, typename detail::move_or_copy_construct_ref<D, deleter_type>::type>::value);
----


[#boost-scope-unique_resource-0c-2constructor-00]

= Function unique_resource::unique_resource



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1219[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
unique_resource(const xref:boost-scope-unique_resource-0c[unique_resource]&) = delete;
----


[#boost-scope-unique_resource-0c-2constructor-08]

= Function unique_resource::unique_resource



== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource.hpp#L1251[boost/scope/unique_resource.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    bool Requires = std::is_move_constructible<data>::value,
    typename = enable_if<Requires>::type>
unique_resource(xref:boost-scope-unique_resource-0c[unique_resource]&& that) noexcept(std::is_nothrow_move_constructible<data>::value);
----


Created with MrDocs
