CVS difference for ais/ai-20302.txt
--- ais/ai-20302.txt 2005/08/21 06:00:46 1.22
+++ ais/ai-20302.txt 2005/10/31 05:18:49 1.23
@@ -1,4 +1,4 @@
-!standard A.18 (00) 05-07-26 AI95-00302-03/14
+!standard A.18 (00) 05-09-20 AI95-00302-03/15
!standard A.18.1 (00)
!standard A.18.2 (00)
!standard A.18.3 (00)
@@ -181,7 +181,7 @@
with Ada.Containers;
function Ada.Strings.Hash (Key : String) return Containers.Hash_Type;
-pragma Pure (Hash);
+pragma Pure(Hash);
Returns an implementation-defined value which is a function of the value of Key.
If A and B are strings such that A equals B, Hash(A) equals Hash(B).
@@ -191,7 +191,7 @@
with Ada.Containers, Ada.Strings.Hash;
function Ada.Strings.Fixed.Hash (Key : String) return Containers.Hash_Type
renames Ada.Strings.Hash;
-pragma Pure (Hash);
+pragma Pure(Hash);
The generic library function Strings.Bounded.Hash has the following declaration:
@@ -201,7 +201,7 @@
new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
function Ada.Strings.Bounded.Hash (Key : Bounded.Bounded_String)
return Containers.Hash_Type;
-pragma Preelaborate (Hash);
+pragma Preelaborate(Hash);
Strings.Bounded.Hash is equivalent to the function call
Strings.Hash (Bounded.To_String (Key));
@@ -211,7 +211,7 @@
with Ada.Containers;
function Ada.Strings.Unbounded.Hash (Key : Unbounded_String)
return Containers.Hash_Type;
-pragma Preelaborate (Hash);
+pragma Preelaborate(Hash);
Strings.Unbounded.Hash is equivalent to the function call
Strings.Hash (To_String (Key));
@@ -386,7 +386,7 @@
Implementation Advice
Hash_Type'Modulus should be at least 2**32. Count_Type'Last should be at least
-2**31-1.
+2**31 @endash 1.
AARM Note: 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
@@ -406,7 +406,7 @@
elements that can be inserted into the vector prior to it being automatically
expanded.
-Elements in a vector container can be refered to by an index value of a
+Elements in a vector container can be referred to by an index value of a
generic formal type. The first element of a vector always has its index
value equal to the lower bound of the formal type.
@@ -715,8 +715,8 @@
Cursor is not otherwise initialized, it is initialized to the same value as
No_Element.
-The predefined "=" operator for type Cursor should return True if both cursors
-or No_Element, or designate the same element in the same container.
+The predefined "=" operator for type Cursor returns True if both cursors
+are No_Element, or designate the same element in the same container.
Execution of the default implementation of the Input, Output, Read, or Write
attribute of type Cursor raises Program_Error.
@@ -730,7 +730,7 @@
existence of Index_Type'Last + 1, as it is only used as the position of
insertions (and needs to be allowed only when inserting an empty vector).
-Some operations are assumed to work on a constant set of elements. During
+Some operations are assumed to work on a constant set of elements. During the
execution of such an operation, a subprogram is said to *tamper with cursors*
of a vector object V if:
@@ -749,7 +749,7 @@
Swap, Sort, and Merge copy elements rather than reordering them, so
they do not tamper with cursors.
-Some operations are assumed to not replace elements. During the execution of such an operation, a
+Some operations are assumed not to replace elements. During the execution of such an operation, a
subprogram is said to *tamper with elements* of a vector object V if:
* it tampers with cursors of V; or
@@ -1038,10 +1038,10 @@
New_Item : in Vector);
If Before is not No_Element, and does not designate an element in
-Target, then Program_Error is propagated.
+Container, then Program_Error is propagated.
Otherwise, if Length(New_Item) is 0, then Insert does nothing.
If Before is No_Element, then the call is equivalent to Insert (Container,
-Last_Index (Container) + 1), New_Item); otherwise the call is
+Last_Index (Container) + 1, New_Item); otherwise the call is
equivalent to Insert (Container, To_Index (Before), New_Item);
AARM Note: The check on Before checks that the cursor does not belong to some
@@ -1057,7 +1057,7 @@
Position : out Cursor);
If Before is not No_Element, and does not designate an element in
-Target, then Program_Error is propagated.
+Container, then Program_Error is propagated.
If Before equals No_Element, then
let T be Last_Index (Container) + 1; otherwise, let T be To_Index (Before).
Insert (Container, T, New_Item) is called, and then Position is set to
@@ -1094,14 +1094,14 @@
Count : in Count_Type := 1);
If Before is not in the range First_Index (Container) .. Last_Index (Container)
-+ 1, then Constraint_Error is propagated. If Count is 0, then Insert_Space does
++ 1, then Constraint_Error is propagated. If Count is 0, then Insert does
nothing. Otherwise, it computes the new length *NL* as the sum of the current
length and Count; if the value of Last appropriate for length NL would be
greater than Index_Type'Last then Constraint_Error is propagated.
If the current vector capacity is less than or equal to NL,
Reserve_Capacity (Container, NL) is called to increase the vector capacity.
-Then Insert_Space slides the elements in the range Before .. Last_Index
+Then Insert slides the elements in the range Before .. Last_Index
(Container) up by Count positions, and then inserts elements that
are initialized by default (see 3.3.1) in the positions starting at Before.
@@ -1111,7 +1111,7 @@
Count : in Count_Type := 1);
If Before is not No_Element, and does not designate an element in
-Target, then Program_Error is propagated.
+Container, then Program_Error is propagated.
If Before equals No_Element, then let T be Last_Index (Container) + 1;
otherwise, let T be To_Index (Before). Insert (Container, T, Count) is
called, and then Position is set to To_Cursor (Container, T).
@@ -1161,7 +1161,7 @@
Count : in Count_Type := 1);
If Before is not No_Element, and does not designate an element in
-Target, then Program_Error is propagated.
+Container, then Program_Error is propagated.
If Before equals No_Element, then let T be Last_Index (Container) + 1;
otherwise, let T be To_Index (Before). Insert_Space (Container, T, Count) is
called, and then Position is set to To_Cursor (Container, T).
@@ -1200,7 +1200,7 @@
If Length (Container) <= Count then Delete_Last is equivalent to
Clear (Container). Otherwise it is equivalent to Delete (Container,
-Index_Type'Val(Index_Type'Pos(Last_Index(Container)) - Count + 1), Count).
+Index_Type'Val(Index_Type'Pos(Last_Index (Container)) - Count + 1), Count).
procedure Reverse_Elements (Container : in out Vector);
@@ -1209,9 +1209,9 @@
procedure Swap (Container : in out Vector;
I, J : in Index_Type);
-If I or J is not in the range First_Index (Container) .. Last_Index (Container),
-then Constraint_Error is propagated. Otherwise, Swap exchanges the values of
-the elements at positions I and J.
+If either I or J is not in the range First_Index (Container) .. Last_Index
+(Container), then Constraint_Error is propagated. Otherwise, Swap exchanges the
+values of the elements at positions I and J.
AARM Notes: To Be Honest: The implementation is not required to actually
copy the elements if it can do the swap some other way. But it is allowed
@@ -1268,7 +1268,7 @@
function Next (Position : Cursor) return Cursor;
If Position equals No_Element or designates the last element of the container,
-then Next returns the value No_Element. Otherwise, returns a cursor that
+then Next returns the value No_Element. Otherwise, it returns a cursor that
designates the element with index To_Index (Position) + 1 in the same vector as
Position.
@@ -1279,7 +1279,7 @@
function Previous (Position : Cursor) return Cursor;
If Position equals No_Element or designates the first element of the container,
-then Previous returns the value No_Element. Otherwise, returns a cursor that
+then Previous returns the value No_Element. Otherwise, it returns a cursor that
designates the element with index (To_Index (Position) - 1) in the same vector
as Position.
@@ -1292,8 +1292,8 @@
Index : Index_Type := Index_Type'First)
return Extended_Index;
-Searches the elements of Container for an element equal to Item (in the sense
-of the generic formal equality operator). The search starts at position Index
+Searches the elements of Container for an element equal to Item (using
+the generic formal equality operator). The search starts at position Index
and proceeds towards Last_Index (Container). If no equal element is found, then
Find_Index returns No_Index. Otherwise, it returns the index of the first equal
element encountered.
@@ -1305,7 +1305,7 @@
If Position is not No_Element, and does not designate an element in Container,
then Program_Error is propagated. Otherwise Find searches the elements of
-Container for an element equal to Item (in the sense of the generic formal
+Container for an element equal to Item (using the generic formal
equality operator). The search starts at the first element if Cursor equals
No_Element, and at the element designated by Cursor otherwise. It proceeds
towards the last element of Container. If no equal element is found, then
@@ -1317,8 +1317,8 @@
Index : Index_Type := Index_Type'Last)
return Extended_Index;
-Searches the elements of Container for an element equal to Item (in the sense
-of the generic formal equality operator). The search starts at position Index
+Searches the elements of Container for an element equal to Item (using
+the generic formal equality operator). The search starts at position Index
or, if Index is greater than Last_Index (Container), at position Last_Index
(Container). It proceeds towards First_Index (Container). If no equal element
is found, then Reverse_Find_Index returns No_Index. Otherwise, it returns the
@@ -1331,7 +1331,7 @@
If Position is not No_Element, and does not designate an element in Container,
then Program_Error is propagated. Otherwise Reverse_Find searches the elements
-of Container for an element equal to Item (in the sense of the generic formal
+of Container for an element equal to Item (using the generic formal
equality operator). The search starts at the last element if Cursor equals
No_Element, and at the element designated by Cursor otherwise. It proceeds
towards the first element of Container. If no equal element is found, then
@@ -1450,7 +1450,7 @@
An instantiation of Containers.Vectors shall be at the library level.
AARM Note
-A implementation will typically need to use controlled types to insure that
+A implementation will typically need to use controlled types to ensure that
the Implementation Requirements are met. These would require all instantiations
to occur at the library level. We certainly do not want to require magic
for nested container instantiations, while not giving similar capabilities to
@@ -1498,7 +1498,7 @@
It is a bounded error to call any subprogram other than "=" or Has_Element
declared in Containers.Vectors with an ambiguous (but not invalid, see below)
cursor parameter. Possible results are:
- * The cursor may be treated as if it was No_Element;
+ * The cursor may be treated as if it were No_Element;
* The cursor may designate some element in the vector (but not necessarily
the element that it originally designated);
* Constraint_Error may be raised; or
@@ -1645,7 +1645,7 @@
type Element_Type is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Doubly_Linked_Lists is
- pragma Preelaborate (Doubly_Linked_Lists);
+ pragma Preelaborate(Doubly_Linked_Lists);
type List is tagged private;
pragma Preelaborable_Initialization(List);
@@ -1829,13 +1829,13 @@
Cursor is not otherwise initialized, it is initialized to the same value as
No_Element.
-The predefined "=" operator for type Cursor should return True if both cursors
-or No_Element, or designate the same element in the same container.
+The predefined "=" operator for type Cursor returns True if both cursors
+are No_Element, or designate the same element in the same container.
Execution of the default implementation of the Input, Output, Read, or Write
attribute of type Cursor raises Program_Error.
-Some operations are assumed to work on a constant set of elements. During
+Some operations are assumed to work on a constant set of elements. During the
execution of such an operation, a subprogram is said to *tamper with cursors*
of a list object L if:
@@ -1857,7 +1857,7 @@
Swap copies elements rather than reordering them, so it doesn't tamper
with cursors.
-Some operations are assumed to not replace elements. During the execution of such an operation, a
+Some operations are assumed not to replace elements. During the execution of such an operation, a
subprogram is said to *tamper with elements* of a list object L if:
* it tampers with cursors of L; or
@@ -1949,7 +1949,7 @@
Count : in Count_Type := 1);
If Before is not No_Element, and does not designate an element in
-Target, then Program_Error is propagated.
+Container, then Program_Error is propagated.
Otherwise, Insert inserts Count copies of
New_Item prior to the element designated by Before. If Before equals
No_Element, the new elements are inserted after the last node (if any). Any
@@ -1970,7 +1970,7 @@
Count : in Count_Type := 1);
If Before is not No_Element, and does not designate an element in
-Target, then Program_Error is propagated.
+Container, then Program_Error is propagated.
Otherwise, Insert allocates Count copies of
New_Item, and inserts them prior to the element designated by Before. If Before
equals No_Element, the new elements are inserted after the last element (if
@@ -1984,7 +1984,7 @@
Count : in Count_Type := 1);
If Before is not No_Element, and does not designate an element in
-Target, then Program_Error is propagated.
+Container, then Program_Error is propagated.
Otherwise, Insert inserts Count new elements
prior to the element designated by Before. If Before equals No_Element, the new
elements are inserted after the last node (if any). The new elements are
@@ -2049,9 +2049,9 @@
procedure Swap_Links (Container : in out List;
I, J : in Cursor);
-If either I or J is No_Element, then Constraint_Error is propagated. If I or J
-do not designate an element in Container, then Program_Error is propagated.
-Otherwise, Swap_Links exchanges the nodes designated by I and J.
+If either I or J is No_Element, then Constraint_Error is propagated. If either
+I or J do not designate an element in Container, then Program_Error is
+propagated. Otherwise, Swap_Links exchanges the nodes designated by I and J.
AARM Note: Unlike Swap, this exchanges the nodes, not the
elements. No copying is performed. I and J designate the same elements after
@@ -2140,7 +2140,7 @@
If Position is not No_Element, and does not designate an element
in Container, then Program_Error is propagated. Find searches the elements of
-Container for an element equal to Item (in the sense of the generic formal
+Container for an element equal to Item (using the generic formal
equality operator). The search starts at the element designated by Position, or
at the first element if Position equals No_Element. It proceeds towards Last
(Container). If no equal element is found, then Find returns No_Element.
@@ -2153,7 +2153,7 @@
If Position is not No_Element, and does not designate an element
in Container, then Program_Error is propagated. Find searches the elements of
-Container for an element equal to Item (in the sense of the generic formal
+Container for an element equal to Item (using the generic formal
equality operator). The search starts at the element designated by Position, or
at the last element if Position equals No_Element. It proceeds towards First
(Container). If no equal element is found, then Reverse_Find returns
@@ -2248,7 +2248,7 @@
bounded error can be recovered by sorting Target after the merge call, or
the lists can be pretested with Is_Sorted.
-Bounded Errors
+Bounded (Run-Time) Errors
Calling Merge in an instance of Generic_Sorting with either Source or Target
not ordered smallest first using the provided generic formal "<" operator
@@ -2390,7 +2390,7 @@
in the map exactly once until the last node is reached. The exact definition of
these terms is different for hashed maps and ordered maps.
-Some operations are assumed to work on a constant set of elements. During
+Some operations are assumed to work on a constant set of elements. During the
execution of such an operation, a subprogram is said to *tamper with cursors*
of a map object M if:
@@ -2409,7 +2409,7 @@
Replace only modifies a key and element rather than rehashing, so it does
not tamper with cursors.
-Some operations are assumed to not replace elements. During the execution of such an operation, a
+Some operations are assumed not to replace elements. During the execution of such an operation, a
subprogram is said to *tamper with elements* of a map object M if:
* it tampers with cursors of M; or
@@ -2431,8 +2431,8 @@
Cursor is not otherwise initialized, it is initialized to the same
value as No_Element.
-The predefined "=" operator for type Cursor should return True if both cursors
-or No_Element, or designate the same element in the same container.
+The predefined "=" operator for type Cursor returns True if both cursors
+are No_Element, or designate the same element in the same container.
Execution of the default implementation of the Input, Output, Read, or Write
attribute of type Cursor raises Program_Error.
@@ -2751,7 +2751,7 @@
with function "=" (Left, Right : Element_Type)
return Boolean is <>;
package Ada.Containers.Hashed_Maps is
- pragma Preelaborate (Hashed_Maps);
+ pragma Preelaborate(Hashed_Maps);
type Map is tagged private;
pragma Preelaborable_Initialization(Map);
@@ -2911,7 +2911,7 @@
The actual function for the generic formal function Equivalent_Keys on Key_Type values
is expected to return the same value each time it is called with a particular
-pair of key values. It must define an equivalence relationship, that is, be
+pair of key values. It should define an equivalence relationship, that is, be
reflexive, symmetric, and transitive. If the actual for Equivalent_Keys behaves
in some other manner, the behavior of this package is unspecified. Which
subprograms of this package call Equivalent_Keys, and how many times they call
@@ -3107,7 +3107,7 @@
with function "<" (Left, Right : Key_Type) return Boolean is <>;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Ordered_Maps is
- pragma Preelaborate (Ordered_Maps);
+ pragma Preelaborate(Ordered_Maps);
function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
@@ -3255,8 +3255,8 @@
returns True if Left and Right are equivalent, and False otherwise.
The actual function for the generic formal function "<" on Key_Type values is expected
-to return the same value each time it is called with a particular pair of key
-values. It must define a strict ordering relationship, that is, be irreflexive,
+to return the same value each time it is called with a particular pair of key
+values. It should define a strict ordering relationship, that is, be irreflexive,
asymmetric, and transitive. If the actual for "<" behaves in some other manner,
the behavior of this package is unspecified. Which subprograms of this package
call "<" and how many times they call it, is unspecified.
@@ -3337,7 +3337,7 @@
function Previous (Position : Cursor) return Cursor;
If Position equals No_Element, then Previous returns No_Element. Otherwise
-Previous returns the a cursor designating the node that precedes the one
+Previous returns a cursor designating the node that precedes the one
designated by Position. If Position designates the first element, then Previous
returns No_Element.
@@ -3390,6 +3390,7 @@
Iterates over the nodes in Container as per Iterate, with the difference that
the nodes are traversed in predecessor order, starting with the last node.
+
Implementation Advice
If *N* is the length of a map, then the worst-case time complexity of the
@@ -3457,7 +3458,7 @@
last element is reached. The exact definition of these terms is different for
hashed sets and ordered sets.
-Some operations are assumed to work on a constant set of elements. During
+Some operations are assumed to work on a constant set of elements. During the
execution of such an operation, a subprogram is said to *tamper with cursors*
of a set object S if:
@@ -3479,7 +3480,7 @@
* it calls the Move procedure with S as a parameter; or
* it calls one of the operations defined to tamper with cursors of S.
-Some operations are assumed to not replace elements. During the execution of such an operation, a
+Some operations are assumed not to replace elements. During the execution of such an operation, a
subprogram is said to *tamper with elements* of a set object S if:
* it tampers with cursors of S.
@@ -3505,8 +3506,8 @@
Cursor is not otherwise initialized, it is initialized to the same
value as No_Element.
-The predefined "=" operator for type Cursor should return True if both cursors
-or No_Element, or designate the same element in the same container.
+The predefined "=" operator for type Cursor returns True if both cursors
+are No_Element, or designate the same element in the same container.
Execution of the default implementation of the Input, Output, Read, or Write
attribute of type Cursor raises Program_Error.
@@ -3516,7 +3517,7 @@
If Left and Right denote the same set object, then the function returns True.
If Left and Right have different lengths, then the function returns False.
Otherwise, for each element E in Left, the function returns False if an element
-equal to E (in the sense of the generic formal equality operator) is not
+equal to E (using the generic formal equality operator) is not
present in Right. If the function has not returned a result after checking all
of the elements, it returns True. Any exception raised during evaluation of
element equality is propagated.
@@ -3530,6 +3531,10 @@
result after checking all of the elements, it returns True. Any exception raised
during evaluation of element equivalence is propagated.
+function To_Set (New_Item : Element_Type) return Set;
+
+Returns a set containing the single element New_Item.
+
function Length (Container : Set) return Count_Type;
Returns the number of elements in Container.
@@ -3788,14 +3793,18 @@
element. It is expected to return the same value each time it is called with a
particular element. The behavior of Generic_Keys is unspecified if Key behaves
in some other manner.
+
+A key is expected to unambiguously determine a single equivalence class for
+elements. The behavior of Generic_Keys is unspecified if the formal parameters
+of this package behave in some other manner.
-A key is expected to unambiguously determine one equivalence class for elements.
-The behavior of Generic_Keys is unspecified if the formal parameters of this
-package behave in some other manner.
+function Key (Position : Cursor) return Key_Type;
+
+Equivalent to Key (Element (Position)).
The subprograms in package Generic_Keys named Contains, Find, Element, Delete,
and Exclude, are equivalent to the corresponding subprograms in the parent
-package, with the difference that the Key parameter is used locate an element
+package, with the difference that the Key parameter is used to locate an element
in the set.
procedure Replace (Container : in out Set;
@@ -3804,10 +3813,6 @@
Equivalent to Replace_Element (Container, Find (Container, Key), New_Item).
-function Key (Position : Cursor) return Key_Type;
-
-Equivalent to Key (Element (Position)).
-
procedure Update_Element_Preserving_Key
(Container : in out Set;
Position : in Cursor;
@@ -3824,7 +3829,7 @@
as that for the new element; if not, the element is removed from the set and
Program_Error is propagated.
-AARM Note: The key check insures that the invariants of the set are preserved
+AARM Note: The key check ensures that the invariants of the set are preserved
by the modification.
If Element_Type is unconstrained and definite, then the actual Element parameter
@@ -3904,7 +3909,7 @@
return Boolean;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Hashed_Sets is
- pragma Preelaborate (Hashed_Sets);
+ pragma Preelaborate(Hashed_Sets);
type Set is tagged private;
pragma Preelaborable_Initialization(Set);
@@ -3920,6 +3925,8 @@
function Equivalent_Sets (Left, Right : Set) return Boolean;
+ function To_Set (New_Item : Element_Type) return Set;
+
function Capacity (Container : Set) return Count_Type;
procedure Reserve_Capacity (Container : in out Set;
@@ -4020,11 +4027,11 @@
function Equivalent_Elements (Left : Cursor;
Right : Element_Type)
- return Boolean;
+ return Boolean;
function Equivalent_Elements (Left : Element_Type;
Right : Cursor)
- return Boolean;
+ return Boolean;
procedure Iterate
(Container : in Set;
@@ -4091,7 +4098,7 @@
The actual function for the generic formal function Equivalent_Elements is expected to
return the same value each time it is called with a particular pair of Element
-values. It must define an equivalence relationship, that is, be reflexive,
+values. It should define an equivalence relationship, that is, be reflexive,
symmetric, and transitive. If the actual for Equivalent_Elements behaves in
some other manner, the behavior of this package is unspecified. Which
subprograms of this package call Equivalent_Elements, and how many times they
@@ -4166,12 +4173,12 @@
Equivalent to Equivalent_Elements (Left, Element (Right)).
For any element E, the actual function for the generic formal function Generic_Keys.Hash
-must be such that Hash (E) = Generic_Keys.Hash (Key (E)). If the actuals for
+is expected to be such that Hash (E) = Generic_Keys.Hash (Key (E)). If the actuals for
Key or Generic_Keys.Hash behave in some other manner, the behavior of
Generic_Keys is unspecified. Which subprograms of Generic_Keys call
Generic_Keys.Hash, and how many times they call it, is unspecified.
-For any two elements E1 and E2, the boolean values Equivalent_Element (E1, E2)
+For any two elements E1 and E2, the boolean values Equivalent_Elements (E1, E2)
and Equivalent_Keys (Key (E1), Key (E2)) are expected to be equal. If the
actuals for Key or Equivalent_Keys behave in some other manner, the behavior of
Generic_Keys is unspecified. Which subprograms of Generic_Keys call
@@ -4202,7 +4209,7 @@
with function "<" (Left, Right : Element_Type) return Boolean is <>;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Ordered_Sets is
- pragma Preelaborate (Ordered_Sets);
+ pragma Preelaborate(Ordered_Sets);
function Equivalent_Elements (Left, Right : Element_Type)
return Boolean;
@@ -4221,6 +4228,8 @@
function Equivalent_Sets (Left, Right : Set) return Boolean;
+ function To_Set (New_Item : Element_Type) return Set;
+
function Length (Container : Set) return Count_Type;
function Is_Empty (Container : Set) return Boolean;
@@ -4420,7 +4429,7 @@
The actual function for the generic formal function "<" on Element_Type values is
expected to return the same value each time it is called with a particular pair
-of key values. It must define a strict ordering relationship, that is, be
+of key values. It should define a strict ordering relationship, that is, be
irreflexive, asymmetric, and transitive. If the actual for "<" behaves in some
other manner, the behavior of this package is unspecified. Which subprograms of
this package call "<" and how many times they call it, is unspecified.
@@ -4555,7 +4564,7 @@
The language-defined generic package Containers.Indefinite_Vectors provides a
private type Vector and a set of operations. It provides the same
-operations as the package Containers.Vectors (see A.18.2) does, with the
+operations as the package Containers.Vectors (see A.18.2), with the
difference that the generic formal Element_Type is indefinite.
Static Semantics
@@ -4590,9 +4599,8 @@
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 (see A.18.3)
-does, with the difference that the generic formal Element_Type is
-indefinite.
+Containers.Doubly_Linked_Lists (see A.18.3),
+with the difference that the generic formal Element_Type is indefinite.
Static Semantics
@@ -4754,7 +4762,7 @@
with function "<" (Left, Right : Element_Type)
return Boolean is <>;
procedure Ada.Containers.Generic_Array_Sort (Container : in out Array_Type);
- pragma Pure (Ada.Containers.Generic_Array_Sort);
+ pragma Pure(Ada.Containers.Generic_Array_Sort);
Reorders the elements of Container such that the elements are
sorted smallest first as determined by the generic formal "<" operator
@@ -4792,7 +4800,7 @@
return Boolean is <>;
procedure Ada.Containers.Generic_Constrained_Array_Sort
(Container : in out Array_Type);
- pragma Pure (Ada.Containers.Generic_Constrained_Array_Sort);
+ pragma Pure(Ada.Containers.Generic_Constrained_Array_Sort);
Reorders the elements of Container such that the elements are
sorted smallest first as determined by the generic formal "<" operator
@@ -5090,22 +5098,12 @@
... -- modify E some more
Replace_Element (V, Index => I, New_Item => E); -- aka V(I) := E;
end;
-
-All containers are nonlimited, and hence allow ordinary assignment. In
-the unique case of a vector, there is a separate assignment procedure:
- Assign (Target => V1, Source => V2);
+All containers are nonlimited, and hence allow ordinary assignment. Assignments
+are deep copies; that is, the elements as well as the container itself are
+copied by an assignment.
-The reason is that the model for a vector is that it's implemented using
-an unconstrained array. During ordinary assignment, the internal array
-is deallocated (during controlled finalization), and then a new internal
-array is allocated (during controlled adjustment) to store a copy of the
-elements from the source vector. However, assignment would probably be
-more efficient if it were able to hold on to the existing array, and
-simply copy the elements of the source onto that array, instead of
-having to allocate a new one. This is exactly how Assign works.
-
A.18.3 The Package Containers.Doubly_Linked_Lists
You can use a doubly-linked list to implement a queue in the traditional
@@ -6594,7 +6592,7 @@
@xcode<@b<with> Ada.Containers;
@b<function> Ada.Strings.Hash (Key : String) @b<return> Containers.Hash_Type;
-@b<pragma> Pure (Hash);>
+@b<pragma> Pure(Hash);>
@xindent<Returns an implementation-defined value which is a function of the
value of Key. If @i<A> and @i<B> are strings such that @i<A> equals @i<B>,
@@ -6605,7 +6603,7 @@
@xcode<@b<with> Ada.Containers, Ada.Strings.Hash;
@b<function> Ada.Strings.Fixed.Hash (Key : String) @b<return> Containers.Hash_Type
@b<renames> Ada.Strings.Hash;
-@b<pragma> Pure (Hash);>
+@b<pragma> Pure(Hash);>
The generic library function Strings.Bounded.Hash has the following declaration:
@@ -6615,7 +6613,7 @@
@b<new> Ada.Strings.Bounded.Generic_Bounded_Length (<@>);
@b<function> Ada.Strings.Bounded.Hash (Key : Bounded.Bounded_String)
@b<return> Containers.Hash_Type;
-@b<pragma> Pure (Hash);>
+@b<pragma> Preelaborate(Hash);>
Strings.Bounded.Hash is equivalent to the function call
Strings.Hash (Bounded.To_String (Key));
@@ -6625,7 +6623,7 @@
@xcode<@b<with> Ada.Containers;
@b<function> Ada.Strings.Unbounded.Hash (Key : Unbounded_String)
@b<return> Containers.Hash_Type;
-@b<pragma> Pure (Hash);>
+@b<pragma> Preelaborate(Hash);>
Strings.Unbounded.Hash is equivalent to the function call
Strings.Hash (To_String (Key));
@@ -6686,7 +6684,7 @@
@i<@s8<Implementation Advice>>
Hash_Type'Modulus should be at least 2**32. Count_Type'Last should be at least
-2**31-1.
+2**31@endash1.
!corrigendum A.18.2
@@ -6703,7 +6701,7 @@
elements that can be inserted into the vector prior to it being automatically
expanded.
-Elements in a vector container can be refered to by an index value of a
+Elements in a vector container can be referred to by an index value of a
generic formal type. The first element of a vector always has its index
value equal to the lower bound of the formal type.
@@ -6808,9 +6806,6 @@
Position : @b<in> Cursor;
Process : @b<not null access procedure> (Element : @b<in out> Element_Type));
- @b<procedure> Assign (Target : @b<in out> Vector;
- Source : @b<in> Vector);
-
@b<procedure> Move (Target : @b<in out> Vector;
Source : @b<in out> Vector);
@@ -6992,8 +6987,8 @@
Cursor is not otherwise initialized, it is initialized to the same value as
No_Element.
-The predefined "=" operator for type Cursor should return True if both cursors
-or No_Element, or designate the same element in the same container.
+The predefined "=" operator for type Cursor returns True if both cursors
+are No_Element, or designate the same element in the same container.
Execution of the default implementation of the Input, Output, Read, or Write
attribute of type Cursor raises Program_Error.
@@ -7002,7 +6997,7 @@
subtype Extended_Index includes the indices covered by Index_Type plus the
value No_Index and, if it exists, the successor to the Index_Type'Last.
-Some operations are assumed to work on a constant set of elements. During
+Some operations are assumed to work on a constant set of elements. During the
execution of such an operation, a subprogram is said to @i<tamper with cursors>
of a vector object @i<V> if:
@@ -7015,7 +7010,7 @@
@xbullet<it calls the Move procedure with @i<V> as
a parameter.>
-Some operations are assumed to not replace elements. During the execution of such an operation, a
+Some operations are assumed not to replace elements. During the execution of such an operation, a
subprogram is said to @i<tamper with elements> of a vector object @i<V> if:
@xbullet<it tampers with cursors of @i<V>; or>
@@ -7153,10 +7148,10 @@
Process : @b<not null access> @b<procedure> (Element : @b<in> Element_Type));>
@xindent<If Index is not in the range First_Index (Container) .. Last_Index (Container),
-then Constraint_Error is propagated. Otherwise, Query_Element calls Process.all
+then Constraint_Error is propagated. Otherwise, Query_Element calls Process.@b<all>
with the element at position Index as the argument. Program_Error is propagated
-if Process.all tampers with the elements of Container. Any exception raised by
-Process.all is propagated.>
+if Process.@b<all> tampers with the elements of Container. Any exception raised by
+Process.@b<all> is propagated.>
@xcode<@b<procedure> Query_Element
(Position : @b<in> Cursor;
@@ -7202,15 +7197,6 @@
@xindent<The element designated by Position is not an empty element after successful
completion of this operation.>
-@xcode<@b<procedure> Assign (Target : @b<in out> Vector;
- Source : @b<in> Vector);>
-
-@xindent<If Target denotes the same object as Source, then the operation has no effect.
-Otherwise, Assign first calls Clear (Target), then Reserve_Capacity (Target,
-Length (Source)). It then assigns the elements of Source to the corresponding
-positions in Target, and sets the length of Target to the length of Source.
-Any exception raised during element assignment is propagated.>
-
@xcode<@b<procedure> Move (Target : @b<in out> Vector;
Source : @b<in out> Vector);>
@@ -7245,7 +7231,7 @@
Container, then Program_Error is propagated. Otherwise, if Length(New_Item)
is 0, then Insert does nothing.
If Before is No_Element, then the call is equivalent to Insert (Container,
-Last_Index (Container) + 1), New_Item); otherwise the call is
+Last_Index (Container) + 1, New_Item); otherwise the call is
equivalent to Insert (Container, To_Index (Before), New_Item);>
@xcode<@b<procedure> Insert (Container : @b<in out> Vector;
@@ -7287,14 +7273,14 @@
Count : @b<in> Count_Type := 1);>
@xindent<If Before is not in the range First_Index (Container) .. Last_Index (Container)
-+ 1, then Constraint_Error is propagated. If Count is 0, then Insert_Space does
++ 1, then Constraint_Error is propagated. If Count is 0, then Insert does
nothing. Otherwise, it computes the new length @i<NL> as the sum of the current
length and Count; if the value of Last appropriate for length @i<NL> would be
greater than Index_Type'Last then Constraint_Error is propagated.>
@xindent<If the current vector capacity is less than or equal to @i<NL>,
Reserve_Capacity (Container, @i<NL>) is called to increase the vector capacity.
-Then Insert_Space slides the elements in the range Before .. Last_Index
+Then Insert slides the elements in the range Before .. Last_Index
(Container) up by Count positions, and then inserts elements that are
initialized by default (see 3.3.1) in the positions starting at Before.>
@@ -7363,7 +7349,7 @@
Index : @b<in> Extended_Index;
Count : @b<in> Count_Type := 1);>
-@xindent<If Index is not in the range First_Index (Container) .. Last_Index (Container),
+@xindent<If Index is not in the range First_Index (Container) .. Last_Index (Container) + 1,
then Constraint_Error is propagated. If Count is 0, Delete has no effect.
Otherwise Delete slides the elements (if any) starting at position Index +
Count down to Index. Any exception raised during element assignment is
@@ -7388,7 +7374,7 @@
@xindent<If Length (Container) <= Count then Delete_Last is equivalent to
Clear (Container). Otherwise it is equivalent to Delete (Container,
-Index_Type'Val(Index_Type'Pos(Last_Index(Container)) @endash Count + 1), Count).>
+Index_Type'Val(Index_Type'Pos(Last_Index (Container)) @endash Count + 1), Count).>
@xcode<@b<procedure> Reverse_Elements (Container : @b<in out> Vector);>
@@ -7397,9 +7383,9 @@
@xcode<@b<procedure> Swap (Container : @b<in out> Vector;
I, J : @b<in> Index_Type);>
-@xindent<If I or J is not in the range First_Index (Container) .. Last_Index (Container),
-then Constraint_Error is propagated. Otherwise, Swap exchanges the values of
-the elements at positions I and J.>
+@xindent<If either I or J is not in the range First_Index (Container) ..
+Last_Index (Container), then Constraint_Error is propagated. Otherwise, Swap
+exchanges the values of the elements at positions I and J.>
@xcode<@b<procedure> Swap (Container : @b<in out> Vector;
I, J : @b<in> Cursor);>
@@ -7439,7 +7425,7 @@
@xcode<@b<function> Next (Position : Cursor) @b<return> Cursor;>
@xindent<If Position equals No_Element or designates the last element of the container,
-then Next returns the value No_Element. Otherwise, returns a cursor that
+then Next returns the value No_Element. Otherwise, it returns a cursor that
designates the element with index To_Index (Position) + 1 in the same vector as
Position.>
@@ -7450,7 +7436,7 @@
@xcode<@b<function> Previous (Position : Cursor) @b<return> Cursor;>
@xindent<If Position equals No_Element or designates the first element of the container,
-then Previous returns the value No_Element. Otherwise, returns a cursor that
+then Previous returns the value No_Element. Otherwise, it returns a cursor that
designates the element with index (To_Index (Position) @endash 1) in the same
vector as Position.>
@@ -7463,8 +7449,8 @@
Index : Index_Type := Index_Type'First)
@b<return> Extended_Index;>
-@xindent<Searches the elements of Container for an element equal to Item (in the sense
-of the generic formal equality operator). The search starts at position Index
+@xindent<Searches the elements of Container for an element equal to Item (using
+the generic formal equality operator). The search starts at position Index
and proceeds towards Last_Index (Container). If no equal element is found, then
Find_Index returns No_Index. Otherwise, it returns the index of the first equal
element encountered.>
@@ -7476,7 +7462,7 @@
@xindent<If Position is not No_Element, and does not designate an element in Container,
then Program_Error is propagated. Otherwise Find searches the elements of
-Container for an element equal to Item (in the sense of the generic formal
+Container for an element equal to Item (using the generic formal
equality operator). The search starts at the first element if Cursor equals
No_Element, and at the element designated by Cursor otherwise. It proceeds
towards the last element of Container. If no equal element is found, then
@@ -7488,8 +7474,8 @@
Index : Index_Type := Index_Type'Last)
@b<return> Extended_Index;>
-@xindent<Searches the elements of Container for an element equal to Item (in the sense
-of the generic formal equality operator). The search starts at position Index
+@xindent<Searches the elements of Container for an element equal to Item (using
+the generic formal equality operator). The search starts at position Index
or, if Index is greater than Last_Index (Container), at position Last_Index
(Container). It proceeds towards First_Index (Container). If no equal element
is found, then Reverse_Find_Index returns No_Index. Otherwise, it returns the
@@ -7502,7 +7488,7 @@
@xindent<If Position is not No_Element, and does not designate an element in Container,
then Program_Error is propagated. Otherwise Reverse_Find searches the elements
-of Container for an element equal to Item (in the sense of the generic formal
+of Container for an element equal to Item (using the generic formal
equality operator). The search starts at the last element if Cursor equals
No_Element, and at the element designated by Cursor otherwise. It proceeds
towards the first element of Container. If no equal element is found, then
@@ -7592,7 +7578,7 @@
declared in Containers.Vectors with an ambiguous (but not invalid, see below)
cursor parameter. Possible results are:
-@xbullet<The cursor may be treated as if it was No_Element;>
+@xbullet<The cursor may be treated as if it were No_Element;>
@xbullet<The cursor may designate some element in the vector (but not
necessarily the element that it originally designated);>
@xbullet<Constraint_Error may be raised; or>
@@ -7645,7 +7631,7 @@
If an exception is propagated from a vector operation, no storage should be
lost, nor any elements removed from a vector unless specified by the operation.
-@xindent<@s9<NOTES:@hr
+@xindent<@s9<NOTES@hr
41 All elements of a vector occupy locations in the internal array.
If a sparse container is required, a Hashed_Map should be used rather than a
vector.
@@ -7682,7 +7668,7 @@
@b<type> Element_Type @b<is private>;
@b<with function> "=" (Left, Right : Element_Type) @b<return> Boolean @b<is> <@>;
@b<package> Ada.Containers.Doubly_Linked_Lists @b<is>
- @b<pragma> Preelaborate (Doubly_Linked_Lists);
+ @b<pragma> Preelaborate(Doubly_Linked_Lists);
@b<type> List @b<is tagged private>;
@b<pragma> Preelaborable_Initialization(List);
@@ -7856,13 +7842,13 @@
Cursor is not otherwise initialized, it is initialized to the same value as
No_Element.
-The predefined "=" operator for type Cursor should return True if both cursors
-or No_Element, or designate the same element in the same container.
+The predefined "=" operator for type Cursor returns True if both cursors
+are No_Element, or designate the same element in the same container.
Execution of the default implementation of the Input, Output, Read, or Write
attribute of type Cursor raises Program_Error.
-Some operations are assumed to work on a constant set of elements. During
+Some operations are assumed to work on a constant set of elements. During the
execution of such an operation, a subprogram is said to @i<tamper with cursors>
of a list object @i<L> if:
@@ -7876,7 +7862,7 @@
@xbullet<it finalizes @i<L>; or>
@xbullet<it calls the Move procedure with @i<L> as a parameter.>
-Some operations are assumed to not replace elements. During the execution of such an operation, a
+Some operations are assumed not to replace elements. During the execution of such an operation, a
subprogram is said to @i<tamper with elements> of a list object @i<L> if:
@xbullet<it tampers with cursors of @i<L>; or>
@@ -7985,7 +7971,7 @@
Count : @b<in> Count_Type := 1);>
@xindent<If Before is not No_Element, and does not designate an element in
-Target, then Program_Error is propagated.
+Container, then Program_Error is propagated.
Otherwise, Insert inserts Count new elements
prior to the element designated by Before. If Before equals No_Element, the new
elements are inserted after the last node (if any). The new elements are
@@ -8042,9 +8028,10 @@
@xcode<@b<procedure> Swap_Links (Container : @b<in out> List;
I, J : @b<in> Cursor);>
-@xindent<If either I or J is No_Element, then Constraint_Error is propagated. If I or J
-do not designate an element in Container, then Program_Error is propagated.
-Otherwise, Swap_Links exchanges the nodes designated by I and J.>
+@xindent<If either I or J is No_Element, then Constraint_Error is propagated.
+If either I or J do not designate an element in Container, then Program_Error
+is propagated. Otherwise, Swap_Links exchanges the nodes designated by I and
+J.>
@xcode<@b<procedure> Splice (Target : @b<in out> List;
Before : @b<in> Cursor;
@@ -8077,16 +8064,12 @@
incremented, the length of Source is decremented, and Position is updated to
represent an element in Target.>
-@xcode<@b<procedure> Splice (Container : @b<in out> List;
+@xcode<@b<procedure> Splice (Container: @b<in out> List;
Before : @b<in> Cursor;
Position : @b<in out> Cursor);>
-@xindent<If either of Before or Position is not No_Element, and does not designate an
-element in Target, then Program_Error is propagated. If Position equals
-No_Element, or if Position equals Before, or if the successor of Position
-equals Before, the operation has no effect. Otherwise the element designated by
-Position is moved immediately prior to Before, or, if Before equals No_Element,
-after the last element.>
+@xindent<Equivalent to Splice (Target =@> Container, Before =@> Before,
+Source =@> Container, Position =@> Position);>
@xcode<@b<function> First (Container : List) @b<return> Cursor;>
@@ -8133,7 +8116,7 @@
@xindent<If Position is not No_Element, and does not designate an element
in Container, then Program_Error is propagated. Find searches the elements of
-Container for an element equal to Item (in the sense of the generic formal
+Container for an element equal to Item (using the generic formal
equality operator). The search starts at the element designated by Position, or
at the first element if Position equals No_Element. It proceeds towards Last
(Container). If no equal element is found, then Find returns No_Element.
@@ -8146,7 +8129,7 @@
@xindent<If Position is not No_Element, and does not designate an element
in Container, then Program_Error is propagated. Find searches the elements of
-Container for an element equal to Item (in the sense of the generic formal
+Container for an element equal to Item (using the generic formal
equality operator). The search starts at the element designated by Position, or
at the last element if Position equals No_Element. It proceeds towards First
(Container). If no equal element is found, then Reverse_Find returns
@@ -8182,7 +8165,7 @@
The actual function for the generic formal function "<" of Generic_Sorting is
expected to return the same value each time it is called with a particular pair
of element values. It should define a strict ordering relationship, that is, be
-irreflexive, asymmetric, and transitive; if should not modify Container. If the
+irreflexive, asymmetric, and transitive; it should not modify Container. If the
actual for "<" behaves in some other manner, the behavior of the subprograms of
Generic_Sorting are unspecified. How many times the subprograms of
Generic_Sorting call "<" is unspecified.
@@ -8211,7 +8194,7 @@
otherwise, the order of elements in Target is unspecified.
Any exception raised during evaluation of "<" is propagated.>
-@i<@s8<Bounded Errors>>
+@i<@s8<Bounded (Run-Time) Errors>>
Calling Merge in an instance of Generic_Sorting with either Source or Target
not ordered smallest first using the provided generic formal "<" operator
@@ -8247,7 +8230,7 @@
complexity of Element, Insert with Count=1, and Delete with Count=1 should be
@i<O>(log @i<N>).
-The worst-case time complexity of a call on procedure Sort of an instantiation
+The worst-case time complexity of a call on procedure Sort of an instance of
Containers.Doubly_Linked_Lists.Generic_Sorting should be @i<O>(@i<N>**2), and
the average time complexity should be better than @i<O>(@i<N>**2).
@@ -8257,7 +8240,7 @@
If an exception is propagated from a list operation, no storage should be
lost, nor any elements removed from a list unless specified by the operation.
-@xindent<@s9<NOTES:@hr
+@xindent<@s9<NOTES@hr
43 Sorting a list never copies elements, and is a stable sort (equal elements
remain in the original order). This is different than sorting an array or
vector, which may need to copy elements, and is probably not a stable sort.>>
@@ -8304,7 +8287,7 @@
in the map exactly once until the last node is reached. The exact definition of
these terms is different for hashed maps and ordered maps.
-Some operations are assumed to work on a constant set of elements. During
+Some operations are assumed to work on a constant set of elements. During the
execution of such an operation, a subprogram is said to @i<tamper with cursors>
of a map object @i<M> if:
@@ -8317,7 +8300,7 @@
@xbullet<it calls one of the operations defined to tamper with the cursors of @i<M>.>
-Some operations are assumed to not replace elements. During the execution of such an operation, a
+Some operations are assumed not to replace elements. During the execution of such an operation, a
subprogram is said to @i<tamper with elements> of a map object @i<M> if:
@xbullet<it tampers with cursors of @i<M>; or>
@@ -8333,8 +8316,8 @@
Cursor is not otherwise initialized, it is initialized to the same
value as No_Element.
-The predefined "=" operator for type Cursor should return True if both cursors
-or No_Element, or designate the same element in the same container.
+The predefined "=" operator for type Cursor returns True if both cursors
+are No_Element, or designate the same element in the same container.
Execution of the default implementation of the Input, Output, Read, or Write
attribute of type Cursor raises Program_Error.
@@ -8584,7 +8567,7 @@
@b<with function> "=" (Left, Right : Element_Type)
@b<return> Boolean is <@>;
@b<package> Ada.Containers.Hashed_Maps @b<is>
- @b<pragma> Preelaborate (Hashed_Maps);
+ @b<pragma> Preelaborate(Hashed_Maps);
@b<type> Map @b<is tagged private>;
@b<pragma> Preelaborable_Initialization(Map);
@@ -8721,7 +8704,7 @@
The actual function for the generic formal function Equivalent_Keys on Key_Type values
is expected to return the same value each time it is called with a particular
-pair of key values. It must define an equivalence relationship, that is, be
+pair of key values. It should define an equivalence relationship, that is, be
reflexive, symmetric, and transitive. If the actual for Equivalent_Keys behaves
in some other manner, the behavior of this package is unspecified. Which
subprograms of this package call Equivalent_Keys, and how many times they call
@@ -8805,7 +8788,7 @@
@b<with function> "<" (Left, Right : Key_Type) @b<return> Boolean @b<is> <@>;
@b<with function> "=" (Left, Right : Element_Type) @b<return> Boolean @b<is> <@>;
@b<package> Ada.Containers.Ordered_Maps @b<is>
- @b<pragma> Preelaborate (Ordered_Maps);
+ @b<pragma> Preelaborate(Ordered_Maps);
@b<function> Equivalent_Keys (Left, Right : Key_Type) @b<return> Boolean;
@@ -8955,7 +8938,7 @@
The actual function for the generic formal function "<" on Key_Type values is expected
to return the same value each time it is called with a particular pair of key
-values. It must define a strict ordering relationship, that is, be irreflexive,
+values. It should define a strict ordering relationship, that is, be irreflexive,
asymmetric, and transitive. If the actual for "<" behaves in some other manner,
the behavior of this package is unspecified. Which subprograms of this package
call "<" and how many times they call it, is unspecified.
@@ -9008,7 +8991,7 @@
@xcode<@b<function> Previous (Position : Cursor) @b<return> Cursor;>
@xindent<If Position equals No_Element, then Previous returns No_Element. Otherwise
-Previous returns the a cursor designating the node that precedes the one
+Previous returns a cursor designating the node that precedes the one
designated by Position. If Position designates the first element, then Previous
returns No_Element.>
@@ -9110,7 +9093,7 @@
last element is reached. The exact definition of these terms is different for
hashed sets and ordered sets.
-Some operations are assumed to work on a constant set of elements. During
+Some operations are assumed to work on a constant set of elements. During the
execution of such an operation, a subprogram is said to @i<tamper with cursors>
of a set object @i<S> if:
@@ -9124,7 +9107,7 @@
@xbullet<it calls one of the operations defined to tamper with cursors of @i<S>.>
-Some operations are assumed to not replace elements. During the execution of such an operation, a
+Some operations are assumed not to replace elements. During the execution of such an operation, a
subprogram is said to @i<tamper with elements> of a set object @i<S> if:
@xbullet<it tampers with cursors of @i<S>.>
@@ -9137,8 +9120,8 @@
Cursor is not otherwise initialized, it is initialized to the same
value as No_Element.
-The predefined "=" operator for type Cursor should return True if both cursors
-or No_Element, or designate the same element in the same container.
+The predefined "=" operator for type Cursor returns True if both cursors
+are No_Element, or designate the same element in the same container.
Execution of the default implementation of the Input, Output, Read, or Write
attribute of type Cursor raises Program_Error.
@@ -9148,7 +9131,7 @@
@xindent<If Left and Right denote the same set object, then the function returns True.
If Left and Right have different lengths, then the function returns False.
Otherwise, for each element @i<E> in Left, the function returns False if an element
-equal to @i<E> (in the sense of the generic formal equality operator) is not
+equal to @i<E> (using the generic formal equality operator) is not
present in Right. If the function has not returned a result after checking all
of the elements, it returns True. Any exception raised during evaluation of
element equality is propagated.>
@@ -9163,6 +9146,10 @@
returns True. Any exception raised during evaluation of element equivalence is
propagated.>
+@xcode<@b<function> To_Set (New_Item : Element_Type) @b<return> Set;>
+
+@xindent<Returns a set containing the single element New_Item.>
+
@xcode<@b<function> Length (Container : Set) @b<return> Count_Type;>
@xindent<Returns the number of elements in Container.>
@@ -9373,14 +9360,18 @@
element. It is expected to return the same value each time it is called with a
particular element. The behavior of Generic_Keys is unspecified if Key behaves
in some other manner.
+
+A key is expected to unambiguously determine a single equivalence class for
+elements. The behavior of Generic_Keys is unspecified if the formal parameters
+of this package behave in some other manner.
-A key is expected to unambiguously determine one equivalence class for elements.
-The behavior of Generic_Keys is unspecified if the formal parameters of this
-package behave in some other manner.
+@xcode<@b<function> Key (Position : Cursor) @b<return> Key_Type;>
+
+@xindent<Equivalent to Key (Element (Position)).>
The subprograms in package Generic_Keys named Contains, Find, Element, Delete,
and Exclude, are equivalent to the corresponding subprograms in the parent
-package, with the difference that the Key parameter is used locate an element
+package, with the difference that the Key parameter is used to locate an element
in the set.
@xcode<@b<procedure> Replace (Container : @b<in out> Set;
@@ -9389,10 +9380,6 @@
@xindent<Equivalent to Replace_Element (Container, Find (Container, Key), New_Item).>
-@xcode<@b<function> Key (Position : Cursor) @b<return> Key_Type;>
-
-@xindent<Equivalent to Key (Element (Position)).>
-
@xcode<@b<procedure> Update_Element_Preserving_Key
(Container : @b<in out> Set;
Position : @b<in> Cursor;
@@ -9410,7 +9397,7 @@
equivalence class as that for the new element; if not, the element is removed
from the set and Program_Error is propagated.>
-@xindent<If Element_Type is unconstrained and definite, then the Element
+@xindent<If Element_Type is unconstrained and definite, then the actual Element
parameter of Process.@b<all> shall be unconstrained.>
@i<@s8<Erroneous Execution>>
@@ -9460,7 +9447,7 @@
@b<return> Boolean;
@b<with function> "=" (Left, Right : Element_Type) @b<return> Boolean @b<is> <@>;
@b<package> Ada.Containers.Hashed_Sets @b<is>
- @b<pragma> Preelaborate (Hashed_Sets);
+ @b<pragma> Preelaborate(Hashed_Sets);
@b<type> Set @b<is tagged private>;
@b<pragma> Preelaborable_Initialization(Set);
@@ -9476,6 +9463,8 @@
@b<function> Equivalent_Sets (Left, Right : Set) @b<return> Boolean;
+ @b<function> To_Set (New_Item : Element_Type) @b<return> Set;
+
@b<function> Capacity (Container : Set) @b<return> Count_Type;
@b<procedure> Reserve_Capacity (Container : @b<in out> Set;
@@ -9576,11 +9565,11 @@
@b<function> Equivalent_Elements (Left : Cursor;
Right : Element_Type)
- @b<return> Boolean;
+ @b<return> Boolean;
@b<function> Equivalent_Elements (Left : Element_Type;
Right : Cursor)
- @b<return> Boolean;
+ @b<return> Boolean;
@b<procedure> Iterate
(Container : @b<in> Set;
@@ -9648,7 +9637,7 @@
The actual function for the generic formal function Equivalent_Elements is
expected to return the same value each time it is called with a particular pair
-of Element values. It must define an equivalence relationship, that is, be
+of Element values. It should define an equivalence relationship, that is, be
reflexive, symmetric, and transitive. If the actual for Equivalent_Elements
behaves in some other manner, the behavior of this package is unspecified.
Which subprograms of this package call Equivalent_Elements, and how many times
@@ -9713,13 +9702,13 @@
@xindent<Equivalent to Equivalent_Elements (Left, Element (Right)).>
-For any element @i<E>, the actual for the generic formal function
-Generic_Keys.Hash must be such that Hash (@i<E>) = Generic_Keys.Hash (Key
+For any element @i<E>, the actual function for the generic formal function
+Generic_Keys.Hash is expected to be such that Hash (@i<E>) = Generic_Keys.Hash (Key
(@i<E>)). If the actuals for Key or Generic_Keys.Hash behave in some other manner, the behavior
of Generic_Keys is unspecified. Which subprograms of Generic_Keys call
Generic_Keys.Hash, and how many times they call it, is unspecified.
-For any two elements @i<E1> and @i<E2>, the boolean values Equivalent_Element
+For any two elements @i<E1> and @i<E2>, the boolean values Equivalent_Elements
(@i<E1>, @i<E2>) and Equivalent_Keys (Key (@i<E1>), Key (@i<E2>)) are
expected to be equal. If the actuals for Key or Equivalent_Keys behave in some other manner,
the behavior of Generic_Keys is unspecified. Which subprograms of Generic_Keys
@@ -9747,7 +9736,7 @@
@b<with function> "<" (Left, Right : Element_Type) @b<return> Boolean @b<is> <@>;
@b<with function> "=" (Left, Right : Element_Type) @b<return> Boolean @b<is> <@>;
@b<package> Ada.Containers.Ordered_Sets @b<is>
- @b<pragma> Preelaborate (Ordered_Sets);
+ @b<pragma> Preelaborate(Ordered_Sets);
@b<function> Equivalent_Elements (Left, Right : Element_Type) @b<return> Boolean;
@@ -9765,6 +9754,8 @@
@b<function> Equivalent_Sets (Left, Right : Set) @b<return> Boolean;
+ @b<function> To_Set (New_Item : Element_Type) @b<return> Set;
+
@b<function> Length (Container : Set) @b<return> Count_Type;
@b<function> Is_Empty (Container : Set) @b<return> Boolean;
@@ -9959,12 +9950,12 @@
Two elements @i<E1> and @i<E2> are @i<equivalent> if both @i<E1> < @i<E2> and
@i<E2> < @i<E1> return False, using the generic formal "<" operator for
-elements. Function Equivalent_Keys returns True if Left and Right are equivalent,
-and False otherwise.
+elements. Function Equivalent_Elements returns True if Left and Right are
+equivalent, and False otherwise.
The actual function for the generic formal function "<" on Element_Type values
is expected to return the same value each time it is called with a particular
-pair of key values. It must define a strict ordering relationship, that is, be
+pair of key values. It should define a strict ordering relationship, that is, be
irreflexive, asymmetric, and transitive. If the actual for "<" behaves in some
other manner, the behavior of this package is unspecified. Which subprograms of
this package call "<" and how many times they call it, is unspecified.
@@ -10064,7 +10055,7 @@
For any two elements @i<E1> and @i<E2>, the boolean values (@i<E1> < @i<E2>)
and (Key(@i<E1>) < Key(@i<E2>)) are expected to be equal.
-If Key or Generic_Keys."<" behave in some other manner, the
+If the actuals for Key or Generic_Keys."<" behave in some other manner, the
behavior of this package is unspecified. Which subprograms of this package
call Key and Generic_Keys."<", and how many times the
functions are called, is unspecified.
@@ -10090,7 +10081,7 @@
The language-defined generic package Containers.Indefinite_Vectors provides a
private type Vector and a set of operations. It provides the same
-operations as the package Containers.Vectors (see A.18.2) does, with the
+operations as the package Containers.Vectors (see A.18.2), with the
difference that the generic formal Element_Type is indefinite.
@i<@s8<Static Semantics>>
@@ -10121,7 +10112,7 @@
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 (see A.18.3) does, with the difference that the
+Containers.Doubly_Linked_Lists (see A.18.3), with the difference that the
generic formal Element_Type is indefinite.
@i<@s8<Static Semantics>>
@@ -10261,7 +10252,7 @@
@b<with function> "<" (Left, Right : Element_Type)
@b<return> Boolean @b<is> <@>;
@b<procedure> Ada.Containers.Generic_Array_Sort (Container : @b<in out> Array_Type);
-@b<pragma> Pure (Ada.Containers.Generic_Array_Sort);>
+@b<pragma> Pure(Ada.Containers.Generic_Array_Sort);>
@xindent<Reorders the elements of Container such that the elements are sorted
smallest first as determined by the generic formal "<" operator provided. Any
@@ -10286,7 +10277,7 @@
@b<return> Boolean @b<is> <@>;
@b<procedure> Ada.Containers.Generic_Constrained_Array_Sort
(Container : @b<in out> Array_Type);
-@b<pragma> Pure (Ada.Containers.Generic_Constrained_Array_Sort);>
+@b<pragma> Pure(Ada.Containers.Generic_Constrained_Array_Sort);>
@xindent<Reorders the elements of Container such that the elements are sorted
smallest first as determined by the generic formal "<" operator provided. Any
Questions? Ask the ACAA Technical Agent