25 std::shared_ptr<void> Guard_;
29 : Guard_ {
nullptr, [
f] (
void*) {
f (); } }
33 SharedScopeGuard () =
delete;
35 SharedScopeGuard (
const SharedScopeGuard&) =
default;
36 SharedScopeGuard (SharedScopeGuard&&) =
default;
38 SharedScopeGuard& operator= (
const SharedScopeGuard&) =
default;
39 SharedScopeGuard& operator= (SharedScopeGuard&&) =
default;
59 template<
typename F1,
typename F2>
60 requires std::is_same_v<F, DefaultScopeGuardDeleter>
64 [f1 = std::move (g1.F_), p1 = g1.Perform_, f2 = std::move (g2.F_), p2 = g2.Perform_]
72 , Perform_ { g1.Perform_ || g2.Perform_ }
78 ScopeGuard (
const ScopeGuard&) =
delete;
79 ScopeGuard& operator= (
const ScopeGuard&) =
delete;
87 Perform_ = other.Perform_;
88 other.Perform_ =
false;
94 , Perform_ { other.Perform_ }
96 other.Perform_ =
false;
124 throw std::logic_error {
"this scope guard has already been converted to a shared one" };
SharedScopeGuard(const F &f)
ScopeGuard< DefaultScopeGuardDeleter > EraseType()
constexpr detail::ExprTree< detail::ExprType::LeafStaticPlaceholder, detail::MemberPtrs< Ptr > > f
requires std::is_same_v< F, DefaultScopeGuardDeleter > ScopeGuard(ScopeGuard< F1 > &&g1, ScopeGuard< F2 > &&g2)
requires(Tup1Size==Tup2Size) const expr auto ZipWith(Tup1 &&tup1
SharedScopeGuard Shared()
std::function< void()> DefaultScopeGuardDeleter
detail::ScopeGuard< F > MakeScopeGuard(const F &f)
Returns an object performing passed function on scope exit.
auto Tup2 &&tup2 noexcept
ScopeGuard(const F &f) noexcept
ScopeGuard(ScopeGuard &&other) noexcept