private with Ada.Streams;
with Ada.Containers;
+with Ada.Iterator_Interfaces;
generic
type Element_Type is private;
package Ada.Containers.Formal_Doubly_Linked_Lists is
pragma Pure;
- type List (Capacity : Count_Type) is tagged private;
+ type List (Capacity : Count_Type) is tagged private with
+ Constant_Indexing => Constant_Reference,
+ Default_Iterator => Iterate,
+ Iterator_Element => Element_Type;
-- pragma Preelaborable_Initialization (List);
type Cursor is private;
No_Element : constant Cursor;
+ function Not_No_Element (Position : Cursor) return Boolean;
+
+ package List_Iterator_Interfaces is new
+ Ada.Iterator_Interfaces (Cursor => Cursor, Has_Element => Not_No_Element);
+
+ function Iterate (Container : List; Start : Cursor)
+ return List_Iterator_Interfaces.Reversible_Iterator'Class;
+
+ function Iterate (Container : List)
+ return List_Iterator_Interfaces.Reversible_Iterator'Class;
+
function "=" (Left, Right : List) return Boolean;
function Length (Container : List) return Count_Type;
end Generic_Sorting;
+ type Constant_Reference_Type
+ (Element : not null access constant Element_Type) is private
+ with
+ Implicit_Dereference => Element;
+
+ function Constant_Reference
+ (Container : List; -- SHOULD BE ALIASED ???
+ Position : Cursor) return Constant_Reference_Type;
+
function Strict_Equal (Left, Right : List) return Boolean;
-- Strict_Equal returns True if the containers are physically equal, i.e.
-- they are structurally equal (function "=" returns True) and that they
type Node_Type is record
Prev : Count_Type'Base := -1;
Next : Count_Type;
- Element : Element_Type;
+ Element : aliased Element_Type;
end record;
+
function "=" (L, R : Node_Type) return Boolean is abstract;
type Node_Array is array (Count_Type range <>) of Node_Type;
for List'Write use Write;
+ type List_Access is access all List;
+ for List_Access'Storage_Size use 0;
+
type Cursor is record
Node : Count_Type := 0;
end record;
No_Element : constant Cursor := (Node => 0);
+ type Constant_Reference_Type
+ (Element : not null access constant Element_Type) is null record;
+
end Ada.Containers.Formal_Doubly_Linked_Lists;