📝 added a note to the discussion #1286

This commit is contained in:
Niels Lohmann 2018-10-23 23:00:43 +02:00
parent b49f76931f
commit 20038e2703
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
2 changed files with 8 additions and 0 deletions

View file

@ -936,6 +936,10 @@ class binary_writer
return 'D'; // float 64 return 'D'; // float 64
} }
// The following to_char_type functions are implement the conversion
// between uint8_t and CharType. In case CharType is not unsigned,
// such a conversion is required to allow values greater than 128.
// See <https://github.com/nlohmann/json/issues/1286> for a discussion.
template < typename C = CharType, template < typename C = CharType,
enable_if_t < std::is_signed<C>::value and std::is_signed<char>::value > * = nullptr > enable_if_t < std::is_signed<C>::value and std::is_signed<char>::value > * = nullptr >
static constexpr CharType to_char_type(std::uint8_t x) noexcept static constexpr CharType to_char_type(std::uint8_t x) noexcept

View file

@ -8981,6 +8981,10 @@ class binary_writer
return 'D'; // float 64 return 'D'; // float 64
} }
// The following to_char_type functions are implement the conversion
// between uint8_t and CharType. In case CharType is not unsigned,
// such a conversion is required to allow values greater than 128.
// See <https://github.com/nlohmann/json/issues/1286> for a discussion.
template < typename C = CharType, template < typename C = CharType,
enable_if_t < std::is_signed<C>::value and std::is_signed<char>::value > * = nullptr > enable_if_t < std::is_signed<C>::value and std::is_signed<char>::value > * = nullptr >
static constexpr CharType to_char_type(std::uint8_t x) noexcept static constexpr CharType to_char_type(std::uint8_t x) noexcept