你好我新來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