QScopedValueRollback class resets a variable to its previous value on destruction.
More...
template<typename T>
class QScopedValueRollback< T >
The QScopedValueRollback class resets a variable to its previous value on destruction. The QScopedAssignment class can be used to revert state when an exception is thrown without needing to write try-catch blocks.
This class can also be used to manage variables that are temporarily set, such as reentrancy guards. The variable will be reset whether the function is exited normally, exited early by a return statement, or exited by an exception.
The T for this templated class must be a data type which supports assignment.
- See also
- QScopedPointer