that&#x27;s the beauty of using destructors to clean things when an object goes out of scope.<p>in your OnScopeExit we could use templates (and not use std::function), that way any callable thing could be called - and it would be lighter than std::function