diff --git a/src/json.hpp b/src/json.hpp index dafc1082..caeb079b 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -4824,6 +4826,7 @@ class binary_reader { using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; + using string_t = typename BasicJsonType::string_t; public: /*! @@ -5607,9 +5611,9 @@ class binary_reader @throw parse_error.110 if input has less than @a len bytes */ template - std::string get_string(const NumberType len) + string_t get_string(const NumberType len) { - std::string result; + string_t result; std::generate_n(std::back_inserter(result), len, [this]() { get(); @@ -5631,7 +5635,7 @@ class binary_reader @throw parse_error.110 if input ended @throw parse_error.113 if an unexpected byte is read */ - std::string get_cbor_string() + string_t get_cbor_string() { check_eof(); @@ -5688,7 +5692,7 @@ class binary_reader case 0x7F: // UTF-8 string (indefinite length) { - std::string result; + string_t result; while (get() != 0xFF) { check_eof(); @@ -5744,7 +5749,7 @@ class binary_reader @throw parse_error.110 if input ended @throw parse_error.113 if an unexpected byte is read */ - std::string get_msgpack_string() + string_t get_msgpack_string() { check_eof(); @@ -6713,7 +6718,7 @@ class serializer return ((u <= 127) ? 0 : ((192 <= u and u <= 223) ? 1 : ((224 <= u and u <= 239) ? 2 - : ((240 <= u and u <= 247) ? 3 : std::string::npos)))); + : ((240 <= u and u <= 247) ? 3 : string_t::npos)))); } /*! @@ -6789,7 +6794,7 @@ class serializer { const auto bytes = bytes_following(static_cast(s[i])); // invalid characters will be detected by throw_if_invalid_utf8 - assert (bytes != std::string::npos); + assert (bytes != string_t::npos); if (bytes == 3) { @@ -6958,7 +6963,7 @@ class serializer { const auto bytes = bytes_following(static_cast(s[i])); // invalid characters will be detected by throw_if_invalid_utf8 - assert (bytes != std::string::npos); + assert (bytes != string_t::npos); // check that the additional bytes are present assert(i + bytes < s.size()); @@ -7186,7 +7191,7 @@ class serializer @since version 3.0.0 */ - static void throw_if_invalid_utf8(const std::string& str) + static void throw_if_invalid_utf8(const string_t& str) { // start with state 0 (= accept) uint8_t state = 0;