diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index 6312020e..133b60f8 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -936,6 +936,10 @@ class binary_writer 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 for a discussion. template < typename C = CharType, enable_if_t < std::is_signed::value and std::is_signed::value > * = nullptr > static constexpr CharType to_char_type(std::uint8_t x) noexcept diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 9e2439ae..2fd5144e 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -8981,6 +8981,10 @@ class binary_writer 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 for a discussion. template < typename C = CharType, enable_if_t < std::is_signed::value and std::is_signed::value > * = nullptr > static constexpr CharType to_char_type(std::uint8_t x) noexcept