more google merge fixes

This commit is contained in:
Derek Bailey
2022-04-19 14:35:20 -07:00
parent ccfb4c20bf
commit 9d45a64036
3 changed files with 4 additions and 2 deletions

View File

@@ -739,7 +739,7 @@ class FlatBufferBuilder {
/// @return Returns a typed `Offset` into the serialized data indicating
/// where the vector is stored.
template<typename StringType = std::string,
typename Alloc = std::allocator<std::string>>
typename Alloc = std::allocator<StringType>>
Offset<Vector<Offset<String>>> CreateVectorOfStrings(
const std::vector<StringType, Alloc> &v) {
return CreateVectorOfStrings(v.cbegin(), v.cend());

View File

@@ -19,6 +19,7 @@
#include "flatbuffers/base.h"
#include "flatbuffers/buffer.h"
#include "flatbuffers/stl_emulation.h"
namespace flatbuffers {

View File

@@ -3267,7 +3267,8 @@ class CppGenerator : public BaseGenerator {
// If set_empty_vectors_to_null option is enabled, for optional fields,
// check to see if there actually is any data in _o->field before
// attempting to access it.
if (opts_.set_empty_vectors_to_null && !field.IsRequired()) {
if (field.attributes.Lookup("nested_flatbuffer") ||
(opts_.set_empty_vectors_to_null && !field.IsRequired())) {
code = value + ".size() ? " + code + " : 0";
}
break;