如何在 flatbuffers cpp 中定义树结构?

问题描述 投票:0回答:0
// ptree.fbs
namespace MyApp;

table PTree {
    name:string;
    value:string;
    type:string;
    children:[Ptree];
}

root_type PTree;

运行

./../flatc --cpp ptree.fbs
时,出现如下错误

error: type referenced but not defined (check namespace): Ptree, originally at: ptree.fbs:7

我应该如何定义

PTree
以便它是递归的?

c++ tree schema recursive-datastructures flatbuffers
© www.soinside.com 2019 - 2024. All rights reserved.