Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scope guard utility #450

Merged
merged 9 commits into from
Mar 10, 2022
Merged

Add scope guard utility #450

merged 9 commits into from
Mar 10, 2022

Conversation

baothientran
Copy link
Contributor

fixes #302

Provide ScopeGuard utility to automatically trigger a function upon exiting the scope

Copy link
Member

@kring kring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @baothientran, this looks great. Just one nitpick below.

* @brief Upon calling ScopeGuard::Release(), the guard will not execute the
* lambda function when exiting a scope
*/
void Release() noexcept { _callExitFuncOnDestruct = false; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void Release() noexcept { _callExitFuncOnDestruct = false; }
void release() noexcept { _callExitFuncOnDestruct = false; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason to wait another cycle for this. I made this tiny change myself and will merge this momentarily.

@kring kring merged commit 3847f83 into main Mar 10, 2022
@kring kring deleted the scope-guard branch March 10, 2022 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants