ScopeHelper
ScopeHelper

Class that allows a function to be run when this object goes out of scope.

Variables
m_outOfScopeFunction
std::function<void()> m_outOfScopeFunction

The function to run when the ScopeHelper goes out of scope.

m_canceled
bool m_canceled

Whether the scope function has been canceled or not.

Functions
ScopeHelper
ScopeHelper(
std::function<void()> scopeFunction
)

Creates a ScopeHelper object.

Parameters
scopeFunction
std::function<void()>

The function to run when the ScopeHelper object is destroyed.

ScopeHelper
~ScopeHelper()

Runs whatever function was assigned in the creation of the ScopeHelper.

cancel
void cancel()

Sets a flag that indicates the originally set function should NOT be run when the ScopeHelper is destroyed.