Annotated Ada Reference Manual (Ada 202y Draft 1)Legal Information
Contents   Index   References   Search   Previous   Next 

A.18.14 The Generic Package Containers.Indefinite_Ordered_Maps

1/2
{AI95-00302-03} The language-defined generic package Containers.Indefinite_Ordered_Maps provides a map with the same operations as the package Containers.Ordered_Maps (see A.18.6), with the difference that the generic formal types Key_Type and Element_Type are indefinite. 

Static Semantics

2/3
{AI95-00302-03} {AI05-0092-1} The declaration of the generic library package Containers.Indefinite_Ordered_Maps has the same contents and semantics as Containers.Ordered_Maps except:
3/2
The generic formal Key_Type is indefinite.
4/2
The generic formal Element_Type is indefinite.
5/2
The procedure with the profile: 
6/2
procedure Insert (Container : in out Map;
                  Key       : in     Key_Type;
                  Position  :    out Cursor;
                  Inserted  :    out Boolean);
7/2
is omitted.
7.a/2
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 case. 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. 
8/2
The actual Element parameter of access subprogram Process of Update_Element may be constrained even if Element_Type is unconstrained.
9/4
{AI12-0035-1} The operations Include, Insert, Replace, and Replace_Element that have a formal parameter of type Element_Type perform indefinite insertion (see A.18). 
9.a/4
Discussion: Some of the named operations also have a formal of the indefinite formal type Key_Type and perform indefinite insertion using that value, but it is sufficient to mention the formal of type Element_Type to cover those. 
10/5
{AI12-0111-1} {AI12-0112-1} The description of Tampering_With_Elements_Prohibited is replaced by:
11/5
Returns True if tampering with elements is prohibited for Container, and False otherwise. 
11.a/5
Reason: Complete 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. 
12/5
{AI12-0111-1} {AI12-0112-1} Tampering_With_Cursors_Prohibited is replaced by Tampering_With_Elements_Prohibited in the postcondition for the operations Reference and Constant_Reference.
13/5
{AI12-0111-1} The operations Replace and Replace_Element are omitted from the nested package Stable.

Extensions to Ada 95

13.a/2
{AI95-00302-03} The generic package Containers.Indefinite_Ordered_Maps is new. 

Inconsistencies With Ada 2012

13.b/4
{AI12-0035-1} Corrigendum: Defined 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 for details.
13.c/5
{AI12-0111-1} 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 for details. 

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe