Regenerate the amalgamated headers

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-19 22:07:12 +02:00
1 parent 63ca8e4c8b
commit 0268477aeb
1 file changed
+9 -3
+9 -3
View File
@@ -94,7 +94,7 @@
#include <array> // array #include <array> // array
#include <cstddef> // size_t #include <cstddef> // size_t
#include <cstring> // memcpy #include <cstring> // memcmp, memcpy
#include <limits> // numeric_limits #include <limits> // numeric_limits
#include <new> // bad_alloc, operator new, placement new #include <new> // bad_alloc, operator new, placement new
#include <string> // string #include <string> // string
@@ -417,6 +417,12 @@ struct document_data
return base[n.flags & node_flags::storage] + n.off; return base[n.flags & node_flags::storage] + n.off;
} }
/// whether the string of node k (a key) is the n bytes at key
bool key_equals(const node& k, const char* key, std::size_t n) const noexcept
{
return k.len == n && (n == 0 || std::memcmp(str(k), key, n) == 0);
}
/// the node after n's subtree (containers span `next` nodes, scalars one) /// the node after n's subtree (containers span `next` nodes, scalars one)
static NLOHMANN_VIEW_ALWAYS_INLINE const node* after(const node* n) noexcept static NLOHMANN_VIEW_ALWAYS_INLINE const node* after(const node* n) noexcept
{ {
@@ -2438,7 +2444,7 @@ inline const node* find_member(const document_data& d, const node* object, const
} }
for (const node* m = document_data::first_child(object); m != end; m = document_data::after(m + 1)) for (const node* m = document_data::first_child(object); m != end; m = document_data::after(m + 1))
{ {
if (m->len == n && std::memcmp(d.str(*m), key, n) == 0) if (d.key_equals(*m, key, n))
{ {
return m; return m;
} }
@@ -2453,7 +2459,7 @@ inline std::size_t count_members(const document_data& d, const node* object, con
const node* const end = document_data::child_end(object); const node* const end = document_data::child_end(object);
for (const node* m = document_data::first_child(object); m != end; m = document_data::after(m + 1)) for (const node* m = document_data::first_child(object); m != end; m = document_data::after(m + 1))
{ {
if (m->len == n && (n == 0 || std::memcmp(d.str(*m), key, n) == 0)) if (d.key_equals(*m, key, n))
{ {
++result; ++result;
} }