diff --git a/include/fmt/core.h b/include/fmt/core.h index 342738c5..838bc947 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -322,10 +322,16 @@ template class basic_string_view { using string_view = basic_string_view; using wstring_view = basic_string_view; +#ifndef __cpp_char8_t +// A UTF-8 code unit type. +enum char8_t : unsigned char {}; +#endif + /** Specifies if ``T`` is a character type. Can be specialized by users. */ template struct is_char : std::false_type {}; template <> struct is_char : std::true_type {}; template <> struct is_char : std::true_type {}; +template <> struct is_char : std::true_type {}; template <> struct is_char : std::true_type {}; template <> struct is_char : std::true_type {}; @@ -719,7 +725,7 @@ template class value { // Get the formatter type through the context to allow different contexts // have different extension points, e.g. `formatter` for `format` and // `printf_formatter` for `printf`. - custom.format = &format_custom_arg< + custom.format = format_custom_arg< T, conditional_t::value, typename Context::template formatter_type, internal::fallback_formatter>>; @@ -1030,7 +1036,6 @@ template class arg_map { class locale_ref { private: const void* locale_; // A type-erased pointer to std::locale. - friend class locale; public: locale_ref() : locale_(nullptr) {} diff --git a/include/fmt/format.h b/include/fmt/format.h index f1dedd9d..9e4c1f5c 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -394,14 +394,6 @@ void buffer::append(const U* begin, const U* end) { } } // namespace internal -// C++20 feature test, since r346892 Clang considers char8_t a fundamental -// type in this mode. If this is the case __cpp_char8_t will be defined. -#if !defined(__cpp_char8_t) -// A UTF-8 code unit type. -enum char8_t : unsigned char {}; -#endif -template <> struct is_char : std::true_type {}; - // A UTF-8 string view. class u8string_view : public basic_string_view { public: