Home

Awesome

Github Releases License

Scope Guard & Defer C++

Scope Guard statement invokes a function with deferred execution until surrounding function returns in cases:

Program control transferring does not influence Scope Guard statement execution. Hence, Scope Guard statement can be used to perform manual resource management, such as file descriptors closing, and to perform actions even if an error occurs.

Features

Examples

Synopsis

Reference

scope_exit

scope_fail

scope_success

defer

Interface of scope_guard

scope_exit, scope_fail, scope_success implement scope_guard interface.

Throwable settings

Remarks

Integration

You should add required file scope_guard.hpp.

References

Licensed under the MIT License