diff --git a/AK/TemporaryChange.h b/AK/TemporaryChange.h index 1219b87d638..7169e93bc1f 100644 --- a/AK/TemporaryChange.h +++ b/AK/TemporaryChange.h @@ -7,6 +7,7 @@ #pragma once #include +#include namespace AK { @@ -15,11 +16,11 @@ class TemporaryChange { public: TemporaryChange(T& variable, T value) : m_variable(variable) - , m_old_value(variable) + , m_old_value(move(variable)) { - m_variable = value; + m_variable = move(value); } - ~TemporaryChange() { m_variable = m_old_value; } + ~TemporaryChange() { m_variable = move(m_old_value); } private: T& m_variable;