prevent name clash (#7133)

This commit is contained in:
Derek Bailey
2022-02-24 22:01:25 -08:00
committed by GitHub
parent 3d903302c3
commit 318594e4b4
4 changed files with 14 additions and 13 deletions

View File

@@ -1965,8 +1965,9 @@ class CppGenerator : public BaseGenerator {
cw.IncrementIdentLevel();
cw += "{{FIELD}}.reserve(o.{{FIELD}}.size());";
cw +=
"for (const auto &v : o.{{FIELD}}) { "
"{{FIELD}}.emplace_back((v) ? new {{TYPE}}(*v) : nullptr); }";
"for (const auto &{{FIELD}}_ : o.{{FIELD}}) { "
"{{FIELD}}.emplace_back(({{FIELD}}_) ? new {{TYPE}}(*{{FIELD}}_) "
": nullptr); }";
vector_copies += cw.ToString();
} else {
// For non-pointer elements, use std::vector's copy constructor in the