diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index a9291bcbd..dbe9484b9 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -1372,7 +1372,8 @@ class binary_writer // is in; nothing is allocated unless the document nests bson_frame current(&document); std::vector parents; - string_t index_name; + // string_t need not be default constructible + string_t index_name("", 0); while (true) { @@ -1459,7 +1460,8 @@ class binary_writer bson_frame current(&document); std::vector parents; std::size_t next_size = 0; - string_t index_name; + // string_t need not be default constructible + string_t index_name("", 0); while (true) { diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index b94841147..ac22b51a0 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -20334,7 +20334,8 @@ class binary_writer // is in; nothing is allocated unless the document nests bson_frame current(&document); std::vector parents; - string_t index_name; + // string_t need not be default constructible + string_t index_name("", 0); while (true) { @@ -20421,7 +20422,8 @@ class binary_writer bson_frame current(&document); std::vector parents; std::size_t next_size = 0; - string_t index_name; + // string_t need not be default constructible + string_t index_name("", 0); while (true) {