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

A.18.1 The Package Containers

1/2
{AI95-00302-03} The package Containers is the root of the containers subsystem. 

Static Semantics

2/2
{AI95-00302-03} The library package Containers has the following declaration: 
3/5
{AI12-0414-1} package Ada.Containers
   with Pure is
4/2
   type Hash_Type is mod implementation-defined;
5/2
   type Count_Type is range 0 .. implementation-defined;
5.1/3
{AI05-0001-1}    Capacity_Error : exception;
6/2
end Ada.Containers;
7/2
{AI95-00302-03} Hash_Type represents the range of the result of a hash function. Count_Type represents the (potential or actual) number of elements of a container.
7.a/2
Implementation defined: The value of Containers.Hash_Type'Modulus. The value of Containers.Count_Type'Last.
7.1/3
 {AI05-0262-1} Capacity_Error is raised when the capacity of a container is exceeded.

Implementation Advice

8/2
{AI95-00302-03} Hash_Type'Modulus should be at least 2**32. Count_Type'Last should be at least 2**31–1. 
8.a/2
Implementation Advice: Containers.Hash_Type'Modulus should be at least 2**32. Containers.Count_Type'Last should be at least 2**31–1.
8.b/2
Discussion: This is not a requirement so that these types can be declared properly on machines with native sizes that are not 32 bits. For instance, a 24-bit target could use 2**24 for Hash_Type'Modulus. 

Extensions to Ada 95

8.c/2
{AI95-00302-03} The package Containers is new. 

Incompatibilities With Ada 2005

8.d/3
{AI05-0001-1} Exception Capacity_Error is added to Containers. If Containers is referenced in a use_clause, and an entity with the name Capacity_Error is defined in a package that is also referenced in a use_clause, the entity Capacity_Error may no longer be use-visible, resulting in errors. This should be rare and is easily fixed if it does occur. 

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