MPD: util/ScopeExit.hxx File Reference

MPD 0.20.18

Data Structures | Macros
ScopeExit.hxx File Reference
`#include "Compiler.h"`
`#include <utility>`
Include dependency graph for ScopeExit.hxx:

Go to the source code of this file.

## Data Structures
class | ScopeExitGuard< F >
| Internal class. More...
struct | ScopeExitTag
| Internal class. More...

## Macros
#define | ScopeExitCat(a, b) a ## b
#define | ScopeExitName(line) ScopeExitCat(at_scope_exit_, line)
#define | AtScopeExit(...) auto ScopeExitName(__LINE__) = ScopeExitTag() + [__VA_ARGS__]()
| Call the block after this macro at the end of the current scope. More...

## Macro Definition Documentation

## ◆ AtScopeExit

#define AtScopeExit | ( |  | ... | ) | auto ScopeExitName(__LINE__) = ScopeExitTag() + [__VA_ARGS__]()

Call the block after this macro at the end of the current scope.

Parameters are lambda captures.

This is exception-safe, however the given code block must not throw exceptions.

This attempts to be a better boost/scope_exit.hpp, without all of Boost's compile-time and runtime bloat.

Definition at line 87 of file ScopeExit.hxx.

## ◆ ScopeExitCat

#define ScopeExitCat | ( |  | a,
|  |  | b
| ) |  | a ## b

Definition at line 74 of file ScopeExit.hxx.

## ◆ ScopeExitName

#define ScopeExitName | ( |  | line | ) | ScopeExitCat(at_scope_exit_, line)

Definition at line 75 of file ScopeExit.hxx.