RAII guard that restores ref to its current value at the end of the scope.
More...
#include <mim/util/util.h>
Public Member Functions | |
| Restore (T &ref) | |
Saves ref and restores it in the destructor. | |
| Restore (T &ref, T value) | |
Saves ref, sets it to value, and restores the saved value in the destructor. | |
| ~Restore () | |
| Restore (const Restore &)=delete | |
| Restore & | operator= (const Restore &)=delete |
RAII guard that restores ref to its current value at the end of the scope.
The two-argument constructor additionally sets ref to value up front (like std::exchange).
|
inlineexplicit |
Saves ref and restores it in the destructor.
Definition at line 180 of file util.h.
Referenced by operator=(), and Restore().
|
inline |
|
inline |
|
delete |
References Restore().
|
delete |
References Restore().