I will begin with an example. Suppose I need to guard a code with a function inside a mutex. There are two ways of implementing this.
#include 
#         
         
There is a proposal for a generic scope guard to be included in the next C++ standard, and I think it is accepted. You can find an implementation here, together with a link to the reference paper.
In principle, it is similar to the classical ScopeGuard, but it also provides some special cases e.g. for C-like file APIs.