反序列化表示非根 table 的 flatbuffers 二进制文件

Deserialize flatbuffers binary that represents non-root table

是否可以反序列化表示非根 table 的二进制平面缓冲区对象?

假设以下平面缓冲区架构:

table Foo {
    ...
}
table Bar {
    value:[Foo];
}
root_type Bar;

假设我们可以访问表示 Foo 对象的二进制数据。是否可以将此二进制文件反序列化为 class Foo 的对象?查看我的 c++ 生成的头文件,我没有看到任何生成的函数,如 GetFoo().

GetFoo 只是声明的 root_type 调用 GetRoot<Foo> 的便利函数,您可以使用 GetRoot<Bar> 访问任何类型作为根,假设缓冲区就是这样构造的。