diff --git a/rogueviz/rogueviz.h b/rogueviz/rogueviz.h index 20cd6affd..e9c524f04 100644 --- a/rogueviz/rogueviz.h +++ b/rogueviz/rogueviz.h @@ -133,6 +133,11 @@ namespace rogueviz { on_cleanup_or_next([backup, &variable] { variable = backup; }); } + template void rv_keep(T& variable) { + T backup = variable; + on_cleanup_or_next([backup, &variable] { variable = backup; }); + } + template void rv_hook(hookset& m, int prio, U&& hook) { int p = addHook(m, prio, hook); auto del = [&m, p] {