你好我新来ada和我想创建一种不受约束的数组,我不知道如何在ada中做到这一点。Ada无约束类型
package data_puzzle is
type rotation is private;
type map(x_l,y_l,z_l : Natural) is private;
type valid_rotations is private;
private
type rotation is array(1..3) of Natural;
type map(x_l,y_l,z_l : Natural) is record
struct : Structure(x_l,y_l,z_l);
rot : rotation;
end record;
type valid_rotations is array(1..24) of map; --how can I make this row work?
end data_puzzle;
结构看起来像这样
type structure(x_l,y_l,z_l : Natural) is record
structure : xyz(1..x_l,1..y_l,1..z_l);
X : Natural := x_l;
Y : Natural := y_l;
Z : Natural := z_l;
end record;
基本上我有一个旋转和数据的地图。然后我想将所有不同的旋转存储在大小为24的列表中。我现在唯一的解决方案是启动 类型valid_rotations是map(x,y,z)的数组(1..24),然后它可以工作。但我不想这样做,因为我不知道那个时候尺寸会是多少。
干杯!
令人困惑的是''type structure''有一个名为'structure'的组件!另外,我不知道为什么当你可以访问判别式时,为什么'type structure'将组件'X','Y','Z'初始化为相应的判别式的值? – 2013-04-07 08:13:21