Change nested_root accessor to be const function.
The `<field>_nested_root()` is not viable from const object. (We usually get `const Monster *`.) Change-Id: I0d0adcb38dd974318608417ee3094c34fb9c480d
This commit is contained in:
parent
620fe1c5cf
commit
c9a840e935
|
@ -242,7 +242,7 @@ static void GenTable(const Parser &parser, StructDef &struct_def,
|
|||
auto nested_root = parser.structs_.Lookup(nested->constant);
|
||||
assert(nested_root); // Guaranteed to exist by parser.
|
||||
code += " const " + nested_root->name + " *" + field.name;
|
||||
code += "_nested_root() { return flatbuffers::GetRoot<";
|
||||
code += "_nested_root() const { return flatbuffers::GetRoot<";
|
||||
code += nested_root->name + ">(" + field.name + "()->Data()); }\n";
|
||||
}
|
||||
// Generate a comparison function for this field if it is a key.
|
||||
|
|
|
@ -138,7 +138,7 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|||
const flatbuffers::Vector<flatbuffers::Offset<Monster>> *testarrayoftables() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Monster>> *>(26); }
|
||||
const Monster *enemy() const { return GetPointer<const Monster *>(28); }
|
||||
const flatbuffers::Vector<uint8_t> *testnestedflatbuffer() const { return GetPointer<const flatbuffers::Vector<uint8_t> *>(30); }
|
||||
const Monster *testnestedflatbuffer_nested_root() { return flatbuffers::GetRoot<Monster>(testnestedflatbuffer()->Data()); }
|
||||
const Monster *testnestedflatbuffer_nested_root() const { return flatbuffers::GetRoot<Monster>(testnestedflatbuffer()->Data()); }
|
||||
const Stat *testempty() const { return GetPointer<const Stat *>(32); }
|
||||
uint8_t testbool() const { return GetField<uint8_t>(34, 0); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
|
|
Loading…
Reference in New Issue