Andrey Semashev wrote: ...
Source:
https://github.com/Lastique/scope
Docs:
https://lastique.github.io/scope/libs/scope/doc/html/index.html ... I have now merged scope_check into scope_exit, as you suggested. There is already a lightweight scope_final guard, so making scope_exit more feature-rich seemed like a good idea. Thanks for the suggestion.
In principle, the implementation can specialize scope_exit for the default case of always_true, so it doesn't have to be any less efficient than before.
Also, for anyone interested, I have created a single-header version of the library that is compatible with godbolt.org:
https://godbolt.org/z/6rvhnTrvn
Feel free to try it online.
PS: The single-header version is not part of the library, as proposed for inclusion into Boost. It's just to simplify the review process.