mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
18 lines
330 B
C++
18 lines
330 B
C++
#pragma once
|
|
|
|
namespace AK {
|
|
|
|
template<typename T>
|
|
class TemporaryChange {
|
|
public:
|
|
TemporaryChange(T& variable, T value) : m_variable(variable), m_old_value(variable) { m_variable = value; }
|
|
~TemporaryChange() { m_variable = m_old_value; }
|
|
|
|
private:
|
|
T& m_variable;
|
|
T m_old_value;
|
|
};
|
|
|
|
}
|
|
|
|
using AK::TemporaryChange;
|