TScopedGuard

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