X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fscope-exit.hpp;h=20d9b892d34d0ff54265035b951d144a9d5b6d4b;hb=f74e820c5e8f81d6416f4557bce8b56ee6be4746;hp=46479bc572439762ecded83cad8d4b682927cac0;hpb=b6bbb1d666531bf061f29884da1b0d7c10f59aa0;p=lttng-tools.git diff --git a/src/common/scope-exit.hpp b/src/common/scope-exit.hpp index 46479bc57..20d9b892d 100644 --- a/src/common/scope-exit.hpp +++ b/src/common/scope-exit.hpp @@ -36,15 +36,15 @@ public: * must be `noexcept` lest we anger the undefined behaviour gods. */ static_assert(details::is_invocation_noexcept::value, - "scope_exit requires a noexcept invocable type"); + "scope_exit requires a noexcept invocable type"); explicit scope_exit(ScopeExitInvocableType&& scope_exit_callable) : - _on_scope_exit{std::forward(scope_exit_callable)} + _on_scope_exit{ std::forward(scope_exit_callable) } { } - scope_exit(scope_exit&& rhs) : - _on_scope_exit{std::move(rhs._on_scope_exit)}, _armed{rhs._armed} + scope_exit(scope_exit&& rhs) noexcept : + _on_scope_exit{ std::move(rhs._on_scope_exit) }, _armed{ rhs._armed } { /* Don't invoke ScopeExitInvocableType for the moved-from copy. */ rhs.disarm(); @@ -58,6 +58,8 @@ public: * also propagate the scope_exit to another scope, should it be needed. */ scope_exit(const scope_exit&) = delete; + scope_exit& operator=(const scope_exit&) = delete; + scope_exit& operator=(scope_exit&&) = delete; scope_exit() = delete; void disarm() noexcept @@ -81,7 +83,7 @@ template scope_exit make_scope_exit(ScopeExitInvocableType&& scope_exit_callable) { return scope_exit( - std::forward(scope_exit_callable)); + std::forward(scope_exit_callable)); } } /* namespace lttng */