scoped_guard

Sets a variable on construction, and restores its previous value on destruction.