#ifndef SCOPE_GUARD_H #define SCOPE_GUARD_H struct ScopeGuard { void (*fn)(void *); // Args args; }; // forall(ttype Args, ttype Ret) // void ?{}(ScopeGuard(Args, Ret) * this) { void ?{}(ScopeGuard * this) { } // // inline // forall(ttype Args, ttype Ret) // void ?{}(ScopeGuard(Args, Ret) * this, Ret (*fn)(Args), Args args) { // this->fn = fn; // // this->args = args; // } // inline // forall(ttype Args, ttype Ret) // void ^?{}(ScopeGuard(Args, Ret) * this) { void ^?{}(ScopeGuard * this) { this->fn(0); } #endif