Workaround brain-damaged conversions

This commit is contained in:
Victor Zverovich
2023-06-26 16:06:24 -07:00
parent a331dbfb65
commit 606f85f8b2
2 changed files with 28 additions and 1 deletions
+3 -1
View File
@@ -286,8 +286,10 @@ struct monostate {
#endif
// This is defined in core.h instead of format.h to avoid injecting in std.
// It is a template to avoid undesirable implicit conversions to std::byte.
#ifdef __cpp_lib_byte
inline auto format_as(std::byte b) -> unsigned char {
template <typename T, FMT_ENABLE_IF(std::is_same<T, std::byte>::value)>
inline auto format_as(T b) -> unsigned char {
return static_cast<unsigned char>(b);
}
#endif