From b6a092f3e057ef12d289eed6b7db0a6d6411340a Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sat, 1 Feb 2025 18:40:39 +0100 Subject: [PATCH] Codechange: make EnumBitSet ConvertibleThroughBase --- src/core/enum_type.hpp | 4 ++-- src/misc/endian_buffer.hpp | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp index d43498f2d6..851dd5618f 100644 --- a/src/core/enum_type.hpp +++ b/src/core/enum_type.hpp @@ -117,8 +117,8 @@ debug_inline constexpr void ToggleFlag(T &x, const T y) template class EnumBitSet { public: - using enum_type = Tenum; ///< Enum type of this EnumBitSet. - using storage_type = Tstorage; ///< Storage type of this EnumBitSet. + using EnumType = Tenum; ///< Enum type of this EnumBitSet. + using BaseType = Tstorage; ///< Storage type of this EnumBitSet, be ConvertibleThroughBase constexpr EnumBitSet() : data(0) {} constexpr EnumBitSet(Tenum value) : data(0) { this->Set(value); } diff --git a/src/misc/endian_buffer.hpp b/src/misc/endian_buffer.hpp index f8ee5ade64..7ba7e3366f 100644 --- a/src/misc/endian_buffer.hpp +++ b/src/misc/endian_buffer.hpp @@ -35,9 +35,6 @@ public: EndianBufferWriter &operator <<(std::string_view data) { this->Write(data); return *this; } EndianBufferWriter &operator <<(bool data) { return *this << static_cast(data ? 1 : 0); } - template - EndianBufferWriter &operator <<(const EnumBitSet &data) { return *this << data.base(); } - template EndianBufferWriter &operator <<(const OverflowSafeInt &data) { return *this << static_cast(data); }; @@ -136,9 +133,6 @@ public: EndianBufferReader &operator >>(std::string &data) { data = this->ReadStr(); return *this; } EndianBufferReader &operator >>(bool &data) { data = this->Read() != 0; return *this; } - template - EndianBufferReader &operator >>(EnumBitSet &data) { data = Tenum{this->Read()}; return *this; } - template EndianBufferReader &operator >>(OverflowSafeInt &data) { data = this->Read(); return *this; };