This commit is contained in:
watrabi
2025-10-28 14:05:46 -04:00
parent 977f1ff4b8
commit c93494f795
452 changed files with 47860 additions and 152 deletions
+33
View File
@@ -0,0 +1,33 @@
#pragma once
namespace RBX
{
// TODO: This probably exists in some other library somewhere...
template <typename V>
class ScopedAssign
{
V* value;
V oldValue;
public:
ScopedAssign() : value(NULL) {}
ScopedAssign(V& value, const V& newValue)
:value(&value)
,oldValue(value)
{
*(this->value) = newValue;
}
~ScopedAssign()
{
if (value)
*value = oldValue;
}
void assign (V& value, const V& newValue)
{
this->value = &value;
oldValue = value;
*(this->value) = newValue;
}
};
}