A.18.12 The Generic Package Containers.Indefinite_Doubly_Linked_Lists
The language-defined generic package Containers.Indefinite_Doubly_Linked_Lists
provides private types List and Cursor, and a set of operations for each
type. It provides the same operations as the package Containers.Doubly_Linked_Lists
), with the difference that the
generic formal Element_Type is indefinite.
The declaration of the generic library package Containers.Indefinite_Doubly_Linked_Lists
has the same contents and semantics as Containers.Doubly_Linked_Lists
The generic formal Element_Type is indefinite.
The procedure with
procedure Insert (Container : in out List;
Before : in Cursor;
Position : out Cursor;
Count : in Count_Type := 1);
Discussion: This procedure is omitted
because there is no way to create a default-initialized object of an
indefinite type. We considered having this routine insert an empty element
similar to the empty elements of a vector, but rejected this possibility
because the semantics are fairly complex and very different from the
existing definite container. That would make it more error-prone to convert
a container from a definite type to an indefinite type; by omitting the
routine completely, any problems will be diagnosed by the compiler.
The actual Element parameter of access subprogram
Process of Update_Element may be constrained even if Element_Type is
The operations Append, Insert, Prepend, and Replace_Element
that have a formal parameter of type Element_Type perform indefinite
insertion (see A.18).
Returns True if tampering
with elements is prohibited for Container, and False otherwise.
replacement of an element can cause its memory to be deallocated while
another operation is holding onto a reference to it. That can't be allowed.
However, a simple modification of (part of) an element is not a problem.
Tampering_With_Cursors_Prohibited is replaced by
Tampering_With_Elements_Prohibited in the postcondition for the operations
Reference and Constant_Reference.
The operations Replace_Element and Swap are omitted
from the nested package Stable.
Extensions to Ada 95
The generic package Containers.Indefinite_Doubly_Linked_Lists
Inconsistencies With Ada 2012
some routines to “perform indefinite insertion”. This could
mean that some calls to those routines would now raise Program_Error
where they previously worked. However, this is extremely unlikely; see
Inconsistencies With Ada 2012 in A.18.11
Defined the Iterator_View aspect, so that the stable
view is used for container element iterators. This leads to a rare situation
where Program_Error will be raised in Ada 2022 for code that would have
worked in Ada 2012. See Inconsistencies With Ada 2012 in A.18.11
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe