MySQL 9.1.0
Source Code Documentation
|
A Lambda to be called at scope exit. More...
#include <scope_guard.h>
Public Member Functions | |
Scope_guard (const TLambda &cleanup_lambda) | |
Scope_guard (const Scope_guard< TLambda > &)=delete | |
Scope_guard (Scope_guard< TLambda > &&moved) | |
~Scope_guard () | |
void | release () |
Releases the scope guard. More... | |
void | reset () |
Calls the cleanup lambda and releases the scope guard. More... | |
Private Attributes | |
bool | m_is_released |
If true the cleanup is not going to be called. More... | |
const TLambda | m_cleanup_lambda |
The cleanup to be called. More... | |
A Lambda to be called at scope exit.
Used as std::scope_exit of sorts. Useful if you can't use unique_ptr to install a specific deleter but still want to do automatic cleanup at scope exit.
Typical use is:
|
inline |
|
delete |
|
inline |
|
inline |
|
inline |
Releases the scope guard.
Makes sure that when scope guard goes out of scope the cleanup lambda is not going to be called.
|
inline |
Calls the cleanup lambda and releases the scope guard.
Useful if you want to explicitly provoke the cleanup earlier than when going out of scope.
|
private |
The cleanup to be called.
|
private |
If true the cleanup is not going to be called.