folly::makeDismissedGuard

Create a scope guard in the dismissed state.

Synopsis

Declared in <folly/ScopeGuard.h>

template<typename F>
[[nodiscard]]
/* implementation-defined */
makeDismissedGuard(F&& f) noexcept(/* see-below */);

Description

The guard can be enabled using .rehire().

Exception specification

This function is potentially-throwing unless noexcept(detail::ScopeGuardImplDecay<F, true>(static_cast<F &&>(f), detail::ScopeGuardDismissed{})).

Return Value

A dismissed scope guard that runs f only after being rehired.

NOTE

The return value should not be discarded.

Parameters

NameDescription
fThe function to execute upon the guard's destruction.

See Also

makeGuard refcode folly/docs/examples/folly/ScopeGuard2.cpp