From 064ce6b6c0b38ca1e54f621dc9e4d4bf3c4b8d5f Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 4 Jun 2019 17:08:58 -0700 Subject: [PATCH] Specialize is_char for character types --- include/fmt/core.h | 6 +++++- include/fmt/format.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 780bb138..b684d615 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -443,7 +443,11 @@ using string_view = basic_string_view; using wstring_view = basic_string_view; /** Specifies if ``T`` is a character type. Can be specialized by users. */ -template struct is_char : std::is_integral {}; +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 {}; /** \rst diff --git a/include/fmt/format.h b/include/fmt/format.h index 98d76d06..1507b4ea 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -400,6 +400,7 @@ void buffer::append(const U* begin, const U* end) { // 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 {