original_order 和 FlatBuffers 中的数组
original_order and Arrays in FlatBuffers
文档说 original_order:
"original_order (on a table): since elements in a table do not need to be stored in any particular order, they are often optimized for space by sorting them to size. This attribute stops that from happening."
我现在有点困惑。我认为 FlatBuffers 表类似于 C++ 中的数组,在我的代码中我没有发现任何问题。例如,我这样定义一个 LineString 几何图形:
table Vec2List {
p:[Vec2];
}
table Linestring {
points:Vec2List;
}
行得通。虽然需要声明 original_order?
您不需要 original_order
。 original_order
影响 table
中字段的顺序。您的表格只有一个字段,因此无论如何它都没有效果。矢量永远不会受到影响。我忘了为什么我们还有那个flag,一般情况下是没有用的。
文档说 original_order:
"original_order (on a table): since elements in a table do not need to be stored in any particular order, they are often optimized for space by sorting them to size. This attribute stops that from happening."
我现在有点困惑。我认为 FlatBuffers 表类似于 C++ 中的数组,在我的代码中我没有发现任何问题。例如,我这样定义一个 LineString 几何图形:
table Vec2List {
p:[Vec2];
}
table Linestring {
points:Vec2List;
}
行得通。虽然需要声明 original_order?
您不需要 original_order
。 original_order
影响 table
中字段的顺序。您的表格只有一个字段,因此无论如何它都没有效果。矢量永远不会受到影响。我忘了为什么我们还有那个flag,一般情况下是没有用的。