7namespace opcua::detail {
14class [[nodiscard]] ScopeExit {
16 static_assert(std::is_nothrow_move_constructible_v<Fn>);
17 static_assert(std::is_invocable_v<Fn>);
19 explicit ScopeExit(Fn&& fn) noexcept
20 : fn_{std::move(fn)} {}
22 ScopeExit(ScopeExit&& other) noexcept
23 : fn_{std::move(other.fn_)},
24 active_{other.active_} {
28 ~ScopeExit() noexcept(std::is_nothrow_invocable_v<Fn>) {
34 ScopeExit(
const ScopeExit&) =
delete;
35 ScopeExit& operator=(
const ScopeExit&) =
delete;
36 ScopeExit& operator=(ScopeExit&&) =
delete;
38 void release() noexcept {