From 20038e270300e249176c981484c2b422e3f9614d Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 23 Oct 2018 23:00:43 +0200 Subject: [PATCH] :memo: added a note to the discussion #1286 --- include/nlohmann/detail/output/binary_writer.hpp | 4 ++++ single_include/nlohmann/json.hpp | 4 ++++ 2 files changed, 8 insertions(+) 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