• David P. Sicilia's avatar
    [C++17] Add Traits class for Tables and Factory function within it. (#5678) · a5d9d0f7
    David P. Sicilia authored
    * Include flattests_cpp17 in unit tests when C++17 build is enabled.
    
    * [C++17] Generate generic table factory function.
    
    1. For each table, generate a convenient free-standing factory
       function that allows creating the table in a generic way by
       specifying only the type.  This is the first change in a series
       of changes to make Flatbuffers generated C++ code more friendly
       to code bases that make use of C++ template metaprogramming
       techniques to manage the serialization process.  Example:
    
         Before :(
    
           // The name of the Flatbuffers type (and namespace) must
           // be hard-coded when writing the factory function.
           auto monster = MyGame::Example::CreateMonster(fbb, ...);
    
         After  :)
    
           using type_to_create = MyGame::Example::Monster;
           // No namespace needed on CreateByTagType.
           auto monster = CreateByTagType((type_to_create*)nullptr,
                                          fbb, ...);
    
       This feature requires building with C++14 or greater, and thus
       it is guarded behind --cpp-std >= c++17 in the flatbuffers C++
       generator.
    
    2. Fix a CMake bug to include C++17 unit tests in test suite.
    
    * [C++17] Replace standalone variadic factory function with type_traits.
    
    Add a `type_traits` to each table class.  This `type_traits` can be
    populated with various compile-time info about the table.  Initially,
    we have the Create* function and type, but is extensible in the future.
    
    * Remove empty line and fix stale comments.
    
    * Rename type_traits to Traits and move fwd declaration.
    
    * Fix parameter evaluation order issue and use lambda for scope.
    a5d9d0f7
Name
Last commit
Last update
..
FlatBuffers.Benchmarks Loading commit data...
FlatBuffers.Test Loading commit data...
MyGame Loading commit data...
cpp17 Loading commit data...
docker Loading commit data...
evolution_test Loading commit data...
fuzzer Loading commit data...
include_test Loading commit data...
namespace_test Loading commit data...
prototest Loading commit data...
rust_usage_test Loading commit data...
union_vector Loading commit data...
BUILD Loading commit data...
DartTest.sh Loading commit data...
GoTest.sh Loading commit data...
JavaScriptTest.js Loading commit data...
JavaScriptTest.sh Loading commit data...
JavaScriptUnionVectorTest.js Loading commit data...
JavaTest.bat Loading commit data...
JavaTest.java Loading commit data...
JavaTest.sh Loading commit data...
KotlinTest.kt Loading commit data...
KotlinTest.sh Loading commit data...
LuaTest.bat Loading commit data...
LuaTest.sh Loading commit data...
PythonTest.sh Loading commit data...
RustTest.bat Loading commit data...
RustTest.sh Loading commit data...
TestAll.sh Loading commit data...
TypeScriptTest.sh Loading commit data...
arrays_test.bfbs Loading commit data...
arrays_test.fbs Loading commit data...
arrays_test.golden Loading commit data...
arrays_test.schema.json Loading commit data...
arrays_test_generated.h Loading commit data...
generate_code.bat Loading commit data...
generate_code.sh Loading commit data...
go_test.go Loading commit data...
javatest.bin Loading commit data...
lobstertest.lobster Loading commit data...
luatest.lua Loading commit data...
monster_extra.fbs Loading commit data...
monster_extra_generated.h Loading commit data...
monster_test.bfbs Loading commit data...
monster_test.fbs Loading commit data...
monster_test.grpc.fb.cc Loading commit data...
monster_test.grpc.fb.h Loading commit data...
monster_test.schema.json Loading commit data...
monster_test_generated.h Loading commit data...
monster_test_generated.js Loading commit data...
monster_test_generated.lobster Loading commit data...
monster_test_generated.rs Loading commit data...
monster_test_generated.ts Loading commit data...
monster_test_my_game.example2_generated.dart Loading commit data...
monster_test_my_game.example_generated.dart Loading commit data...
monster_test_my_game_generated.dart Loading commit data...
monsterdata_extra.json Loading commit data...
monsterdata_python_wire.mon Loading commit data...
monsterdata_test.golden Loading commit data...
monsterdata_test.json Loading commit data...
monsterdata_test.mon Loading commit data...
native_type_test.fbs Loading commit data...
native_type_test_generated.h Loading commit data...
native_type_test_impl.cpp Loading commit data...
native_type_test_impl.h Loading commit data...
phpTest.php Loading commit data...
phpUnionVectorTest.php Loading commit data...
phpUnionVectorTest.sh Loading commit data...
py_test.py Loading commit data...
test.cpp Loading commit data...
test_assert.cpp Loading commit data...
test_assert.h Loading commit data...
test_builder.cpp Loading commit data...
test_builder.h Loading commit data...
unicode_test.json Loading commit data...