diff --git a/include/jsoncons/json_object.hpp b/include/jsoncons/json_object.hpp index 68431373e..d5954cba4 100644 --- a/include/jsoncons/json_object.hpp +++ b/include/jsoncons/json_object.hpp @@ -391,7 +391,7 @@ namespace jsoncons { members_.reserve(count); for (auto s = first; s != last; ++s) { - members_.emplace_back(key_type(s->first,get_allocator()), s->second); + members_.emplace_back(key_type(s->first.c_str(), s->first.size(), get_allocator()), s->second); } std::stable_sort(members_.begin(), members_.end(), [](const key_value_type& a, const key_value_type& b) -> bool {return a.key().compare(b.key()) < 0;}); @@ -534,13 +534,13 @@ namespace jsoncons { auto last = first + count; std::sort(first, last, compare); - members_.emplace_back(key_type(first->name,get_allocator()), std::move(first->value)); + members_.emplace_back(key_type(first->name.c_str(), first->name.size(), get_allocator()), std::move(first->value)); auto prev_it = first; for (auto it = first+1; it != last; ++it) { if (it->name != prev_it->name) { - members_.emplace_back(key_type(it->name,get_allocator()), std::move(it->value)); + members_.emplace_back(key_type(it->name.c_str(), it->name.size(), get_allocator()), std::move(it->value)); } ++prev_it; } @@ -552,7 +552,7 @@ namespace jsoncons { { for (auto s = first; s != last; ++s) { - members_.emplace_back(key_type(s->first,get_allocator()), s->second); + members_.emplace_back(key_type(s->first.c_str(), s->first.size(), get_allocator()), s->second); } std::stable_sort(members_.begin(),members_.end(), [](const key_value_type& a, const key_value_type& b) -> bool {return a.key().compare(b.key()) < 0;}); @@ -1340,10 +1340,10 @@ namespace jsoncons { std::unordered_set keys; for (auto it = first; it != last; ++it) { - key_type key{it->first, get_allocator()}; + key_type key{it->first.c_str(), it->first.size(), get_allocator()}; if (keys.find(key) == keys.end()) { - keys.emplace(key, get_allocator()); + keys.emplace(key.c_str(), key.size(), get_allocator()); members_.emplace_back(std::move(key), it->second); } } diff --git a/include/jsoncons_ext/cbor/cbor_parser.hpp b/include/jsoncons_ext/cbor/cbor_parser.hpp index bf3e6b64a..ab9fb6c9b 100644 --- a/include/jsoncons_ext/cbor/cbor_parser.hpp +++ b/include/jsoncons_ext/cbor/cbor_parser.hpp @@ -63,7 +63,7 @@ class basic_cbor_parser : public ser_context byte_string_type bytes; mapped_string(const string_type& str, const allocator_type& alloc = allocator_type()) - : type(jsoncons::cbor::detail::cbor_major_type::text_string), str(str,alloc), bytes(alloc) + : type(jsoncons::cbor::detail::cbor_major_type::text_string), str(str.c_str(), str.size(), alloc), bytes(alloc) { } diff --git a/test/corelib/src/detail/span_tests.cpp b/test/corelib/src/detail/span_tests.cpp index 270ee574e..9f2a4ad29 100644 --- a/test/corelib/src/detail/span_tests.cpp +++ b/test/corelib/src/detail/span_tests.cpp @@ -23,7 +23,7 @@ TEST_CASE("jsoncons::detail::span constructor tests") SECTION("jsoncons::detail::span(C& c)") { using C = std::vector; - C c = {1,2,3,4}; + C c = {{1,2,3,4}}; jsoncons::detail::span s(c); CHECK(s.size() == c.size());