Rename the emit lambda in the image writer for Qt compatibility

Qt defines emit as an empty macro, so a Qt header included before
json_view.hpp broke the lambda's declaration (see #5865). The slots
variables in the image tests are renamed as well.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-18 04:24:20 +02:00
1 parent 69511f15d3
commit b9ccc0edfb
3 files changed
+11 -11

No files matched your search

+3 -3
View File
@@ -105,7 +105,7 @@ inline void compact_nodes(const document_data& d, std::size_t arena_size, std::v
}
return r;
};
const auto emit = [&](const node * v)
const auto copy_node = [&](const node * v)
{
node r = *v;
switch (static_cast<value_t>(v->kind))
@@ -159,7 +159,7 @@ inline void compact_nodes(const document_data& d, std::size_t arena_size, std::v
}
out.push_back(r);
};
emit(d.nodes);
copy_node(d.nodes);
while (!stack.empty())
{
frame& top = stack.back();
@@ -184,7 +184,7 @@ inline void compact_nodes(const document_data& d, std::size_t arena_size, std::v
v = document_data::deref(top.cur);
top.cur = document_data::after(top.cur);
}
emit(v); // may grow the stack (top is not used afterwards)
copy_node(v); // may grow the stack (top is not used afterwards)
}
}