46 std::shared_ptr<void> Guard_;
50 : Guard_ {
nullptr, [
f] (
void*) {
f (); } }
54 SharedScopeGuard () =
delete;
56 SharedScopeGuard (
const SharedScopeGuard&) =
default;
57 SharedScopeGuard (SharedScopeGuard&&) =
default;
59 SharedScopeGuard& operator= (
const SharedScopeGuard&) =
default;
60 SharedScopeGuard& operator= (SharedScopeGuard&&) =
default;
80 ScopeGuard (
const ScopeGuard&) =
delete;
81 ScopeGuard& operator= (
const ScopeGuard&) =
delete;
89 Perform_ = other.Perform_;
90 other.Perform_ =
false;
96 , Perform_ { other.Perform_ }
98 other.Perform_ =
false;
126 throw std::logic_error {
"this scope guard has already been converted to a shared one" };
constexpr detail::ExprTree< detail::ExprType::LeafStaticPlaceholder, detail::MemberPtrs< Ptr > > f
ScopeGuard< DefaultScopeGuardDeleter > EraseType()
detail::ScopeGuard< F > MakeScopeGuard(const F &f)
Returns an object performing passed function on scope exit.
SharedScopeGuard Shared()
ScopeGuard(const F &f) noexcept
std::function< void()> DefaultScopeGuardDeleter
SharedScopeGuard(const F &f)
ScopeGuard(ScopeGuard &&other) noexcept