Top Prev Next Up Down

The CList

Standard Ada.Containers.Ordered_Maps definition for package CList:
Type Celem is
____record
_____n: Integer;
_____s: CVar;
_____end record;

function cless(Left,Right:Integer) return Boolean; -- support function (<)
function cequal(Left,Right:Celem) return Boolean; -- support function (=)

package CList is new Ada.Containers.Ordered_Maps(
_____Key_Type => Integer,
_____Element_type => Celem,
_____"<"=> cless,
_____"="=> cequal);

Nothing stange about this and standard Ada.Containers.Ordered_Maps support can be used.
But why is Ordered_Maps used and not Vectors, the reason is the possiblity to remove a line or lines without changing the indexing of the CList and also the possiblity to insert a line at a specific index value. These reasons are questionable at least

Insert or append a line as last line

Insert is overloaded for CFix, String and CVar but the line is stored as CVar

procedure Insert(map:in out CList.Map;sourceMap:CList.Map)

Append another CList map to a CList map