Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
|
A helper class for executing a function when leaving a scope, in RAII-style. More...
#include <core.h>
Public Member Functions | |
RAIIHelper (const std::function< void()> &f) | |
Construct a new RAIIHelper. | |
RAIIHelper (const RAIIHelper &)=delete | |
RAIIHelper (RAIIHelper &&other) | |
Move an RAIIHelper into another. | |
RAIIHelper & | operator= (const RAIIHelper &)=delete |
~RAIIHelper () | |
Destroy the RAIIHelper object, executing the given function, if not empty. | |
A helper class for executing a function when leaving a scope, in RAII-style.
util::RAIIHelper::RAIIHelper | ( | const std::function< void()> & | f | ) |
Construct a new RAIIHelper.
f | The function to execute when this object is destructed. |
util::RAIIHelper::RAIIHelper | ( | RAIIHelper && | other | ) |
Move an RAIIHelper into another.
The RAIIHelper being moved is guaranteed to be empty after this, i.e. will not execute any code when being destructed.
other | The RAIIHelper to move. |