[C++] Add Builder and Table typedefs (#5685)

* Add Builder and Table typedefs

This gives us a way to use templates to go from a builder to a table
and back again without having to pass both types in.

* Fix tests/cpp17/generated_cpp17/monster_test_generated.h
This commit is contained in:
Austin Schuh
2019-12-26 14:56:46 -08:00
committed by Wouter van Oortmerssen
parent 31f8799083
commit 901b89e733
11 changed files with 107 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ struct NestedStruct;
struct ArrayStruct;
struct ArrayTable;
struct ArrayTableBuilder;
struct ArrayTableT;
bool operator==(const NestedStruct &lhs, const NestedStruct &rhs);
@@ -229,6 +230,7 @@ inline bool operator!=(const ArrayTableT &lhs, const ArrayTableT &rhs) {
struct ArrayTable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef ArrayTableT NativeTableType;
typedef ArrayTableBuilder Builder;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return ArrayTableTypeTable();
}
@@ -252,6 +254,7 @@ struct ArrayTable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct ArrayTableBuilder {
typedef ArrayTable Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_a(const MyGame::Example::ArrayStruct *a) {