diff --git a/thirdparty/nlohmann_json/nlohmann/json.hpp b/thirdparty/nlohmann_json/nlohmann/json.hpp index 68ee3d8eaa..a70aaf8cbc 100644 --- a/thirdparty/nlohmann_json/nlohmann/json.hpp +++ b/thirdparty/nlohmann_json/nlohmann/json.hpp @@ -1,7 +1,7 @@ /* __ _____ _____ _____ __| | __| | | | JSON for Modern C++ -| | |__ | | | | | | version 3.9.0 +| | |__ | | | | | | version 3.9.1 |_____|_____|_____|_|___| https://github.com/nlohmann/json Licensed under the MIT License . @@ -32,7 +32,7 @@ SOFTWARE. #define NLOHMANN_JSON_VERSION_MAJOR 3 #define NLOHMANN_JSON_VERSION_MINOR 9 -#define NLOHMANN_JSON_VERSION_PATCH 0 +#define NLOHMANN_JSON_VERSION_PATCH 1 #include // all_of, find, for_each #include // nullptr_t, ptrdiff_t, size_t @@ -6759,14 +6759,13 @@ class lexer : public lexer_base default: { unget(); - break; + continue; } } } - break; // quiet CLang compiler default: - break; + continue; } } } @@ -7391,7 +7390,7 @@ scan_number_done: skip_whitespace(); // ignore comments - if (ignore_comments && current == '/') + while (ignore_comments && current == '/') { if (!scan_comment()) { @@ -16409,6 +16408,7 @@ template , using mapped_type = T; using Container = std::vector, Allocator>; using typename Container::iterator; + using typename Container::const_iterator; using typename Container::size_type; using typename Container::value_type; @@ -16421,7 +16421,7 @@ template , ordered_map(std::initializer_list init, const Allocator& alloc = Allocator() ) : Container{init, alloc} {} - std::pair emplace(key_type&& key, T&& t) + std::pair emplace(const key_type& key, T&& t) { for (auto it = this->begin(); it != this->end(); ++it) { @@ -16434,9 +16434,40 @@ template , return {--this->end(), true}; } - T& operator[](Key&& key) + T& operator[](const Key& key) { - return emplace(std::move(key), T{}).first->second; + return emplace(key, T{}).first->second; + } + + const T& operator[](const Key& key) const + { + return at(key); + } + + T& at(const Key& key) + { + for (auto it = this->begin(); it != this->end(); ++it) + { + if (it->first == key) + { + return it->second; + } + } + + throw std::out_of_range("key not found"); + } + + const T& at(const Key& key) const + { + for (auto it = this->begin(); it != this->end(); ++it) + { + if (it->first == key) + { + return it->second; + } + } + + throw std::out_of_range("key not found"); } size_type erase(const Key& key) @@ -16457,6 +16488,74 @@ template , } return 0; } + + iterator erase(iterator pos) + { + auto it = pos; + + // Since we cannot move const Keys, re-construct them in place + for (auto next = it; ++next != this->end(); ++it) + { + it->~value_type(); // Destroy but keep allocation + new (&*it) value_type{std::move(*next)}; + } + Container::pop_back(); + return pos; + } + + size_type count(const Key& key) const + { + for (auto it = this->begin(); it != this->end(); ++it) + { + if (it->first == key) + { + return 1; + } + } + return 0; + } + + iterator find(const Key& key) + { + for (auto it = this->begin(); it != this->end(); ++it) + { + if (it->first == key) + { + return it; + } + } + return Container::end(); + } + + const_iterator find(const Key& key) const + { + for (auto it = this->begin(); it != this->end(); ++it) + { + if (it->first == key) + { + return it; + } + } + return Container::end(); + } + + std::pair insert( value_type&& value ) + { + return emplace(value.first, std::move(value.second)); + } + + std::pair insert( const value_type& value ) + { + for (auto it = this->begin(); it != this->end(); ++it) + { + if (it->first == value.first) + { + return {it, false}; + } + } + Container::push_back(value); + return {--this->end(), true}; + } }; } // namespace nlohmann @@ -17441,7 +17540,7 @@ class basic_json object = nullptr; // silence warning, see #821 if (JSON_HEDLEY_UNLIKELY(t == value_t::null)) { - JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.9.0")); // LCOV_EXCL_LINE + JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.9.1")); // LCOV_EXCL_LINE } break; }