on_scope_end permits to register a functor to be called at scope
end (either exception thrown or normal scope end). this is usefull
for cleanup code that must be run.
usage:
auto cleaner = on_scope_end([]() { cleanup(); });
this helper permits to register a resource and cleanup function to keep
exception safety with C like resource. For exemple, to be sure that a
FILE* will be closed, you can use:
auto file = auto_raii(fopen("filename"), fclose);
file will auto cast to FILE* when needed, and will call fclose when
going out of scope.