Generalize format_as

This commit is contained in:
Victor Zverovich
2023-03-26 07:37:51 -07:00
parent f6276a2c2b
commit 41cfc739fe
4 changed files with 42 additions and 49 deletions
+6 -6
View File
@@ -329,6 +329,12 @@ struct monostate {
# define FMT_ENABLE_IF(...) fmt::enable_if_t<(__VA_ARGS__), int> = 0
#endif
#ifdef __cpp_lib_byte
inline auto format_as(std::byte b) -> unsigned char {
return static_cast<unsigned char>(b);
}
#endif
FMT_BEGIN_DETAIL_NAMESPACE
// Suppresses "unused variable" warnings with the method described in
@@ -1359,12 +1365,6 @@ enum { long_short = sizeof(long) == sizeof(int) };
using long_type = conditional_t<long_short, int, long long>;
using ulong_type = conditional_t<long_short, unsigned, unsigned long long>;
#ifdef __cpp_lib_byte
inline auto format_as(std::byte b) -> unsigned char {
return static_cast<unsigned char>(b);
}
#endif
template <typename T> struct format_as_result {
template <typename U,
FMT_ENABLE_IF(std::is_enum<U>::value || std::is_class<U>::value)>