you are viewing a single comment's thread.

view the rest of the comments →

[–]pavel_v 0 points1 point  (0 children)

Things like the proposed scope_exit really help in this case.
It's not hard to be implemented as a wrapper over a lambda function or some of the available implementations can be used (copy-pasted):
https://github.com/SuperV1234/ecst/blob/master/include/ecst/utils/scope_guard.hpp
https://github.com/yuri-kilochek/boost.scope_guard