template<
typename Callback>
class utils::FastScopeGuard< Callback >
a helper class to perform actions on scope exit
The lambda argument must be explicitly marked as noexcept
. Only use FastScopeGuard if it's proven that the lambda body is noexcept
, otherwise use ScopeGuard.
Usage example:
int x = 0;
{
EXPECT_EQ(x, 0);
}
EXPECT_EQ(x, 1);
- See also
- ScopeGuard for type-erasure and throwing functor support
- Examples
- samples/tcp_full_duplex_service/tcp_full_duplex_service.cpp.
Definition at line 26 of file fast_scope_guard.hpp.