An attempt to recreate finally {} block in C++ like in C# and Java