Commit 064ce6b6 authored by Victor Zverovich's avatar Victor Zverovich

Specialize is_char for character types

parent 7893d853
......@@ -443,7 +443,11 @@ using string_view = basic_string_view<char>;
using wstring_view = basic_string_view<wchar_t>;
/** Specifies if ``T`` is a character type. Can be specialized by users. */
template <typename T> struct is_char : std::is_integral<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<char16_t> : std::true_type {};
template <> struct is_char<char32_t> : std::true_type {};
/**
\rst
......
......@@ -400,6 +400,7 @@ void buffer<T>::append(const U* begin, const U* end) {
// 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.
class u8string_view : public basic_string_view<char8_t> {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment