如果你被允许使用别人的 Ada 95 容器库,你可以试试Ada 95 Booch Components。如果您(被允许)这样做,请不要使用 Lists 包,而是使用 Collections:
with BC.Indefinite_Unmanaged_Containers.Collections;
procedure Towers is
package Abstract_Main_Nodes
is new BC.Indefinite_Unmanaged_Containers (String);
package Main_Nodes is new Abstract_Main_Nodes.Collections;
package Abstract_All_Main_Nodes
is new BC.Indefinite_Unmanaged_Containers (Main_Nodes.Collection,
"=" => Main_Nodes."=");
package All_Main_Nodes is new Abstract_All_Main_Nodes.Collections;
end Towers;
和
with Towers; use Towers;
procedure Main is
Main_Tower : Main_Nodes.Collection;
Main_Towers : All_Main_Nodes.Collection;
begin
Main_Nodes.Append (Main_Tower, "A");
Main_Nodes.Append (Main_Tower, "B");
Main_Nodes.Append (Main_Tower, "D");
Main_Nodes.Append (Main_Tower, "E");
Main_Nodes.Append (Main_Tower, "F");
All_Main_Nodes.Append (Main_Towers, Main_Tower);
Main_Nodes.Clear (Main_Tower);
Main_Nodes.Append (Main_Tower, "C");
等等