Codechange: Make OverflowSafeInt ConvertibleThroughBase. (#13449)

This commit is contained in:
Peter Nelson
2025-02-03 12:53:45 +00:00
committed by GitHub
parent 5f4f78574f
commit 64724b8893
2 changed files with 4 additions and 8 deletions

View File

@@ -35,6 +35,8 @@ private:
/** The non-overflow safe backend to store the value in. */
T m_value;
public:
using BaseType = T;
constexpr OverflowSafeInt() : m_value(0) { }
constexpr OverflowSafeInt(const OverflowSafeInt &other) : m_value(other.m_value) { }
@@ -178,6 +180,8 @@ public:
static inline constexpr OverflowSafeInt<T> max() { return T_MAX; }
static inline constexpr OverflowSafeInt<T> min() { return T_MIN; }
BaseType base() const noexcept { return this->m_value; }
};