summaryrefslogtreecommitdiff
path: root/deimos/core/base.h
diff options
context:
space:
mode:
Diffstat (limited to 'deimos/core/base.h')
-rw-r--r--deimos/core/base.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/deimos/core/base.h b/deimos/core/base.h
index ea14610..0669f07 100644
--- a/deimos/core/base.h
+++ b/deimos/core/base.h
@@ -46,6 +46,8 @@ struct uint128
{
uint64 high;
uint64 low;
+
+ constexpr bool operator==(const uint128& other) const = default;
};
struct SourceLocation
@@ -96,5 +98,13 @@ constexpr T&& forward(deimos::RemoveReference<T>&& t) noexcept // NOLINT
return static_cast<T&&>(t);
}
+template<typename T, typename U = T>
+constexpr T exchange(T& obj, U&& new_value)
+{
+ T old_value = std::move(obj);
+ obj = std::forward<U>(new_value);
+ return old_value;
+}
+
} // namespace std