mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
19 lines
330 B
C
19 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;
|