使用FlatBuffer全反射
相关代码
const reflection::Schema& schema = *reflection::GetSchema( binary_fbs_file.c_str() );
auto root_table = schema.root_table();
auto fields = root_table->fields();
for (size_t = 0; i < fields->size(); i++)
{
auto field = fields->Get( i );
// 14 is the enum number for vector.
if ( field->type()->base_type() == 14 )
{
// How do I check the type of the vector here?
}
}代码中的相关问题,但是如何检查向量的类型呢?它是一个int32,双,字符串吗?
发布于 2022-02-23 00:50:05
field->type()->element()是向量内容的类型。
有关reflection.fbs的详细信息,请参阅element。
https://stackoverflow.com/questions/71229874
复制相似问题