Another name for this style of wrapper, with some extra functionality, is known as a Scope Guard. Wiki page: <a href="https:&#x2F;&#x2F;en.wikibooks.org&#x2F;wiki&#x2F;More_C%2B%2B_Idioms&#x2F;Scope_Guard" rel="nofollow">https:&#x2F;&#x2F;en.wikibooks.org&#x2F;wiki&#x2F;More_C%2B%2B_Idioms&#x2F;Scope_Guar...</a> Clean implementation: <a href="http:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;28413370" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;28413370</a>