add class scoped_push to automatically restore variable on function exit