Move char8_t to fmt/core.h

This commit is contained in:
Victor Zverovich 2019-06-08 09:42:11 -07:00
parent 4faadff0a0
commit 5d9100fa2f
2 changed files with 7 additions and 10 deletions

View File

@ -322,10 +322,16 @@ template <typename Char> class basic_string_view {
using string_view = basic_string_view<char>; using string_view = basic_string_view<char>;
using wstring_view = basic_string_view<wchar_t>; using wstring_view = basic_string_view<wchar_t>;
#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. */ /** Specifies if ``T`` is a character type. Can be specialized by users. */
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<char8_t> : std::true_type {};
template <> struct is_char<char16_t> : std::true_type {}; template <> struct is_char<char16_t> : std::true_type {};
template <> struct is_char<char32_t> : std::true_type {}; template <> struct is_char<char32_t> : std::true_type {};
@ -719,7 +725,7 @@ template <typename Context> class value {
// Get the formatter type through the context to allow different contexts // Get the formatter type through the context to allow different contexts
// have different extension points, e.g. `formatter<T>` for `format` and // have different extension points, e.g. `formatter<T>` for `format` and
// `printf_formatter<T>` for `printf`. // `printf_formatter<T>` for `printf`.
custom.format = &format_custom_arg< custom.format = format_custom_arg<
T, conditional_t<has_formatter<T, Context>::value, T, conditional_t<has_formatter<T, Context>::value,
typename Context::template formatter_type<T>, typename Context::template formatter_type<T>,
internal::fallback_formatter<T, char_type>>>; internal::fallback_formatter<T, char_type>>>;
@ -1030,7 +1036,6 @@ template <typename Context> class arg_map {
class locale_ref { class locale_ref {
private: private:
const void* locale_; // A type-erased pointer to std::locale. const void* locale_; // A type-erased pointer to std::locale.
friend class locale;
public: public:
locale_ref() : locale_(nullptr) {} locale_ref() : locale_(nullptr) {}

View File

@ -394,14 +394,6 @@ void buffer<T>::append(const U* begin, const U* end) {
} }
} // namespace internal } // 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<char8_t> : std::true_type {};
// A UTF-8 string view. // A UTF-8 string view.
class u8string_view : public basic_string_view<char8_t> { class u8string_view : public basic_string_view<char8_t> {
public: public: