_____ _ _ _____ _____
/ ____| | | | / ____| / ____|_ _
| (___ | |_ __ _| |_ ___ | (___ __ ___ _____ _ __ | | _| |_ _| |_
\___ \| __/ _` | __/ _ \ \___ \ / _` \ \ / / _ \ '__| | | |_ _|_ _|
____) | || (_| | || __/ ____) | (_| |\ V / __/ | | |____|_| |_|
|_____/ \__\__,_|\__\___| |_____/ \__,_| \_/ \___|_| \_____|
Branch | Linux/OSX | Windows | License | Codacy |
---|---|---|---|---|
master |
StateSaver - saves the origin variable value and restores on scope exit, undoes any changes that could occure to the object.
- Simple syntax
- C++11
- Header-only
- Dependency-free
void Foo(A& a)
STATE_SAVER(a);
... // Alter state from non-const functions.
... // Other code.
// Original state automatically restored.
}
You should add required file state_saver.hpp and switch to C++11.
- GCC
- Clang
- MSVC