[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

@@ -10,6 +10,7 @@ namespace NamespaceA {
namespace NamespaceB {
struct TableInNestedNS;
struct TableInNestedNSBuilder;
struct TableInNestedNST;
struct StructInNestedNS;
@@ -118,6 +119,7 @@ inline bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs)
struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef TableInNestedNST NativeTableType;
typedef TableInNestedNSBuilder Builder;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return TableInNestedNSTypeTable();
}
@@ -141,6 +143,7 @@ struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct TableInNestedNSBuilder {
typedef TableInNestedNS Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_foo(int32_t foo) {