Skip to content

Commit 981180a

Browse files
committed
Simplify toPlatform Template
- Remove second template parameter on the enum template functions
1 parent 9bd4853 commit 981180a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

utility/endian.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ namespace Utility::Endian
5454
}
5555

5656
// For enums
57-
template<typename T, typename TBase = std::underlying_type_t<T>> requires CanByteswap<T> && std::is_enum_v<T>
57+
template<typename T> requires CanByteswap<T> && std::is_enum_v<T>
5858
constexpr T toPlatform(const Type& src, const T& value) {
59-
if (src != target) return static_cast<T>(byteswap(static_cast<TBase>(value)));
59+
if (src != target) return static_cast<T>(byteswap(static_cast<std::underlying_type_t<T>>(value)));
6060
return value;
6161
}
6262

@@ -67,8 +67,8 @@ namespace Utility::Endian
6767
}
6868

6969
// For enums
70-
template<typename T, typename TBase = std::underlying_type_t<T>> requires CanByteswap<T> && std::is_enum_v<T>
70+
template<typename T> requires CanByteswap<T> && std::is_enum_v<T>
7171
constexpr void toPlatform_inplace(const Type& src, T& value) {
72-
if (src != target) value = static_cast<T>(byteswap(static_cast<TBase>(value)));
72+
if (src != target) value = static_cast<T>(byteswap(static_cast<std::underlying_type_t<T>>(value)));
7373
}
7474
}

0 commit comments

Comments
 (0)