iffl
1.3.4
Implements Intrusive Flat Forward List container
|
template class that can be parametrized with a functor or a lambda that it will call in destructor. More...
#include <iffl_common.h>
Public Member Functions | |
constexpr | scope_guard (G const &g) |
Constructor from an instance of functor. More... | |
constexpr | scope_guard (G &&g) |
Constructor from an instance of functor. More... | |
constexpr | scope_guard (scope_guard &&)=default |
Guard supports moving between scopes. | |
constexpr scope_guard & | operator= (scope_guard &&)=default |
Guard supports moving between scopes. | |
constexpr | scope_guard (scope_guard &)=delete |
Guard does not support copy. | |
constexpr scope_guard & | operator= (scope_guard &)=delete |
Guard does not support copy. | |
~scope_guard () noexcept | |
Destructor attempts to call functor if guard was not disarmed. | |
void | discharge () noexcept |
Use this method to discharge guard now. | |
constexpr void | disarm () noexcept |
Disarming guard tells it not discharge during destruction. | |
constexpr void | arm () noexcept |
Can be used to re-arm guard after prior disarm or discharge. | |
constexpr bool | is_armed () const noexcept |
Tells if guard is armed. More... | |
constexpr | operator bool () const noexcept |
Implicit conversion to bool. More... | |
template class that can be parametrized with a functor or a lambda that it will call in destructor.
Used to execute functor as we are leaving scope, unless it was explicitly disarmed. flat_forward_list uses this helper to deallocate memory on failures. scoped_guald inherits from the functor to minimize type size when functor is an empty type. For more information see Empty Base Class Optimization (EBCO).
G | type of functor or a lambda |
|
inlineexplicit |
Constructor from an instance of functor.
g | - guard we are syncing to the guard |
|
inlineexplicit |
Constructor from an instance of functor.
g | - guard we are syncing to the guard |
|
inlinenoexcept |
Tells if guard is armed.
|
inlineexplicitnoexcept |
Implicit conversion to bool.