mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Move esoteric char type support to format.h
This commit is contained in:
@ -393,12 +393,6 @@ template <typename Char> constexpr bool is_unicode() {
|
|||||||
return FMT_UNICODE || sizeof(Char) != 1 ||
|
return FMT_UNICODE || sizeof(Char) != 1 ||
|
||||||
(sizeof(micro) == 3 && micro[0] == 0xC2 && micro[1] == 0xB5);
|
(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
|
} // namespace detail
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -507,9 +501,6 @@ using wstring_view = basic_string_view<wchar_t>;
|
|||||||
template <typename T> struct is_char : std::false_type {};
|
template <typename T> struct is_char : std::false_type {};
|
||||||
template <> struct is_char<char> : std::true_type {};
|
template <> struct is_char<char> : std::true_type {};
|
||||||
template <> struct is_char<wchar_t> : 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
|
\rst
|
||||||
|
@ -431,6 +431,12 @@ FMT_CONSTEXPR20 T* fill_n(T* out, Size count, char value) {
|
|||||||
return out + count;
|
return out + count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __cpp_char8_t
|
||||||
|
using char8_type = char8_t;
|
||||||
|
#else
|
||||||
|
enum char8_type : unsigned char {};
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename InputIt, typename OutChar>
|
template <typename InputIt, typename OutChar>
|
||||||
using needs_conversion = bool_constant<
|
using needs_conversion = bool_constant<
|
||||||
std::is_same<typename std::iterator_traits<InputIt>::value_type,
|
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
|
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
|
// The number of characters to store in the basic_memory_buffer object itself
|
||||||
// to avoid dynamic memory allocation.
|
// to avoid dynamic memory allocation.
|
||||||
enum { inline_buffer_size = 500 };
|
enum { inline_buffer_size = 500 };
|
||||||
|
Reference in New Issue
Block a user