用 FlatBuffer 全反射获取底层向量类型?

With FlatBuffer full reflection get the underlying vector type?

使用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、双精度、字符串吗?

field->type()->element() 是矢量内容的类型。

有关 element 的详细信息,请参阅 reflection.fbs