Move esoteric char type support to format.h
This commit is contained in:
parent
9ac088f376
commit
5238055f40
@ -393,12 +393,6 @@ template <typename Char> constexpr bool is_unicode() {
|
||||
return FMT_UNICODE || sizeof(Char) != 1 ||
|
||||
(sizeof(micro) == 3 && micro[0] == 0xC2 && micro[1] == 0xB5);
|
||||
}
|
||||
|
||||
#ifdef __cpp_char8_t
|
||||
using char8_type = char8_t;
|
||||
#else
|
||||
enum char8_type : unsigned char {};
|
||||
#endif
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
@ -507,9 +501,6 @@ using wstring_view = basic_string_view<wchar_t>;
|
||||
template <typename T> struct is_char : std::false_type {};
|
||||
template <> struct is_char<char> : std::true_type {};
|
||||
template <> struct is_char<wchar_t> : std::true_type {};
|
||||
template <> struct is_char<detail::char8_type> : std::true_type {};
|
||||
template <> struct is_char<char16_t> : std::true_type {};
|
||||
template <> struct is_char<char32_t> : std::true_type {};
|
||||
|
||||
/**
|
||||
\rst
|
||||
|
@ -431,6 +431,12 @@ FMT_CONSTEXPR20 T* fill_n(T* out, Size count, char value) {
|
||||
return out + count;
|
||||
}
|
||||
|
||||
#ifdef __cpp_char8_t
|
||||
using char8_type = char8_t;
|
||||
#else
|
||||
enum char8_type : unsigned char {};
|
||||
#endif
|
||||
|
||||
template <typename InputIt, typename OutChar>
|
||||
using needs_conversion = bool_constant<
|
||||
std::is_same<typename std::iterator_traits<InputIt>::value_type,
|
||||
@ -634,6 +640,10 @@ void iterator_buffer<OutputIt, T, Traits>::flush() {
|
||||
|
||||
FMT_MODULE_EXPORT_BEGIN
|
||||
|
||||
template <> struct is_char<detail::char8_type> : std::true_type {};
|
||||
template <> struct is_char<char16_t> : std::true_type {};
|
||||
template <> struct is_char<char32_t> : std::true_type {};
|
||||
|
||||
// The number of characters to store in the basic_memory_buffer object itself
|
||||
// to avoid dynamic memory allocation.
|
||||
enum { inline_buffer_size = 500 };
|
||||
|
Loading…
Reference in New Issue
Block a user