Skip to content

Commit

Permalink
not an easy fix. has an overhead cost
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-chrismc committed May 30, 2020
1 parent ddf0988 commit fd6cec9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13787,6 +13787,7 @@ template<typename BasicJsonType>
class serializer
{
using string_t = typename BasicJsonType::string_t;
using char_t = typename string_t::value_type;
using number_float_t = typename BasicJsonType::number_float_t;
using number_integer_t = typename BasicJsonType::number_integer_t;
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
Expand All @@ -13799,7 +13800,7 @@ class serializer
@param[in] ichar indentation character to use
@param[in] error_handler_ how to react on decoding errors
*/
serializer(output_adapter_t<char> s, const char ichar,
serializer(output_adapter_t<char_t> s, const char ichar,
error_handler_t error_handler_ = error_handler_t::strict)
: o(std::move(s))
, loc(std::localeconv())
Expand Down Expand Up @@ -14584,7 +14585,7 @@ class serializer

private:
/// the output of the serializer
output_adapter_t<char> o = nullptr;
output_adapter_t<char_t> o = nullptr;

/// a (hopefully) large enough character buffer
std::array<char, 64> number_buffer{{}};
Expand Down Expand Up @@ -16563,7 +16564,7 @@ class basic_json
const error_handler_t error_handler = error_handler_t::strict) const
{
string_t result;
serializer s(detail::output_adapter<char, string_t>(result), indent_char, error_handler);
serializer s(detail::output_adapter<typename string_t::value_type, string_t>(result), indent_char, error_handler);

if (indent >= 0)
{
Expand Down

3 comments on commit fd6cec9

@nickform-ost
Copy link

@nickform-ost nickform-ost commented on fd6cec9 Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @prince-chrismc . Are these changes being pushed to the upstream dependency? If not and I am already using nlohmann/json and want to add jwt-cpp to my project, do I need to replace the header file from the former project with this copy in order for things to work?

@prince-chrismc
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯 I do not recognize these changes 😖 Give me a few minutes to review where they came from.

@prince-chrismc
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickform-ost, firstly thank you so much for catching this! 🏆

I was playing with supporting std::wstring but reverted it when I discovered it was no easily added.
You can ignore these changes they are not required.

I will open a PR shortly to remove these changes and bump the version too!

Please sign in to comment.