CVS difference for ai05s/ai05-0001-1.txt
--- ai05s/ai05-0001-1.txt 2009/02/18 05:47:31 1.7
+++ ai05s/ai05-0001-1.txt 2009/06/08 06:51:58 1.8
@@ -1,4 +1,4 @@
-!standard A.18(0/2) 09-02-16 AI05-0001-1/04
+!standard A.18(0/2) 09-06-03 AI05-0001-1/05
!class Amendment 05-10-24
!status work item 06-03-15
!status received 05-10-02
@@ -27,953 +27,768 @@
!wording
-Package Containers
+A.4.9 String Hashing
-The library package Containers has the following additional declaration:
+Add the following declarations after A.4.9(11/2):
- Capacity_Error : exception;
-
-
-Bounded Vector
-
-The language-defined generic package Containers.Bounded_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),
-with the difference that internal storage is allocated statically.
-
-[ARG]
-
-Is that last sentence OK?
-
-[END ARG]
-
-Static Semantics
-
-The declaration of the generic library package
-Containers.Bounded_Vectors has the same contents as Containers.Vectors
-except:
-
-The package has Pure categorization.
-
-The container type is declared with a discriminant that specifies the
-capacity:
-
- type Vector (Capacity : Count_Type) is tagged private;
-
-Add the following declarations after A.18.2(34/2):
+The library function Strings.Hash_Case_Insensitive has the following
+declaration:
- procedure Assign (Target : in out Vector; Source : Vector);
+with Ada.Containers;
+function Ada.Strings.Hash_Case_Insensitive
+ (Key : String) return Containers.Hash_Type;
+pragma Pure (Ada.Strings.Hash_Case_Insensitive);
- function Copy (Source : Vector; Capacity : Count_Type := 0)
- return Vector;
+Returns an implementation-defined value which is a function of the value
+of Key, folded to lower case. If A and B are strings such that A equals
+B, Hash_Case_Insensitive(A) equals Hash_Case_Insensitive(B).
-Add the following after A.18.2(147/2):
+The library function Strings.Fixed.Hash_Case_Insensitive has the
+following declaration:
- procedure Assign (Target : in out Vector; Source : Vector);
+with Ada.Containers, Ada.Strings.Hash_Case_Insensitive;
+function Ada.Strings.Fixed.Hash_Case_Insensitive (Key : String)
+ return Containers.Hash_Type renames Ada.Strings.Hash_Case_Insensitive;
+pragma Pure(Hash_Case_Insensitive);
-If Target denotes the same object as Source, the operation has no
-effect. If Source length is greater than Target capacity,
-Reserve_Capacity is called with the Source length as the capacity.
-Each element of Source is then assigned to the matching element of
-Target.
+The generic library function Strings.Bounded.Hash_Case_Insensitive has
+the following declaration:
- function Copy (Source : Vector; Capacity : Count_Type := 0)
- return Vector;
+with Ada.Containers;
+generic
+ with package Bounded is
+ new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
+function Ada.Strings.Bounded.Hash_Case_Insensitive
+ (Key : Bounded.Bounded_String) return Containers.Hash_Type;
+pragma Preelaborate(Hash_Case_Insensitive);
-Returns a vector whose elements match the active elements of Source.
-If Capacity is 0, then the vector capacity is the length of Source; if
-Capacity is equal to or greater than Source.Length, the vector
-capacity is at least the specified value. Otherwise, the operation
-raises Capacity_Error.
+Strings.Bounded.Hash_Case_Insensitive is equivalent to the function call
+Strings.Hash_Case_Insensitive (Bounded.To_String (Key));
-[ARG]
+The library function Strings.Unbounded.Hash_Case_Insensitive has the
+following declaration:
-OK to say above "...who elements match the active elements of Source"?
+with Ada.Containers;
+function Ada.Strings.Unbounded.Hash_Case_Insensitive
+ (Key : Unbounded_String) return Containers.Hash_Type;
+pragma Preelaborate(Hash_Case_Insensitive);
-[END ARG]
+Strings.Unbounded.Hash_Case_Insensitive is equivalent to the function
+call Strings.Hash_Case_Insensitive (To_String (Key));
-[ARG]
-FOR BOUNDED FORM: DECLARE A CAPACITY_SUBTYPE FOR BOUNDED VECTOR
-FOR UNBOUNDED CASE TOO
+A.4.10 String Comparison
-USE SUBTYPE IN COPY, RES_CAP, etc
+The library function Strings.Equal_Case_Insensitive has the following
+declaration:
-TODO: I don't know how to declare this subtype
+function Ada.Strings.Equal_Case_Insensitive
+ (Left, Right : String) return Boolean;
+pragma Pure (Ada.Strings.Equal_Case_Insensitive);
-It's supposed to be
+Compares strings Left and Right, folded to lower case, for equality.
- subtype Capacity_Subtype is Count_Type range 0 .. <expression>;
+The library function Strings.Fixed.Equal_Case_Insensitive has the
+following declaration:
-The intent was to prevent a vector object from having a capacity
-greater than the number of values in the index subtype, e.g.
+with Ada.Containers, Ada.Strings.Equal_Case_Insensitive;
+function Ada.Strings.Fixed.Equal_Case_Insensitive (Key : String)
+ return Boolean renames Ada.Strings.Equal_Case_Insensitive;
+pragma Pure(Equal_Case_Insensitive);
- type IT is range 0 .. 5;
- type ET is ...;
- package P is new Bounded_Vectors (IT, ET);
+The generic library function Strings.Bounded.Equal_Case_Insensitive has
+the following declaration:
- V : P.Vector (10); -- only V[0] .. V[5] are accessible
+with Ada.Containers;
+generic
+ with package Bounded is
+ new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
+function Ada.Strings.Bounded.Equal_Case_Insensitive
+ (Left, Right : Bounded.Bounded_String) return Boolean;
+pragma Preelaborate(Equal_Case_Insensitive);
-Would this work?
+Strings.Bounded.Equal_Case_Insensitive is equivalent to the function call
+Strings.Equal_Case_Insensitive (Bounded.To_String (Key));
- subtype Capacity_Subtype is Count_Type
- range 0 .. Count_Type'Max (0,
- Index_Type'Pos (Index_Type'Last) -
- Index_Type'Pos (Index_Type'First) + 1);
-The problem here is the instantiation:
+The library function Strings.Unbounded.Equal_Case_Insensitive has the
+following declaration:
- package P is new Bounded_Vectors (Natural, ET);
+with Ada.Containers;
+function Ada.Strings.Unbounded.Equal_Case_Insensitive
+ (Left, Right : Unbounded_String) return Boolean;
+pragma Preelaborate(Equal_Case_Insensitive);
-Subtype Natural has more values in the type than Count_Type'Last.
+Strings.Unbounded.Equal_Case_Insensitive is equivalent to the function
+call Strings.Equal_Case_Insensitive (To_String (Key));
-Another option is to raise Constraint_Error (or whatever) at the point
-of declaration of the object -- but that won't work either, since
-the bounded forms aren't controlled.
-If there were a way to return the count of the number of values in the
-type, then the user could pass that as the capacity, and we could
-leave the declaration of the descriminant as-is:
+The library function Strings.Less_Case_Insensitive has the following
+declaration:
- V : P.Vector (IT'Value_Count); -- IT'Value_Count = 6
+function Ada.Strings.Less_Case_Insensitive
+ (Left, Right : String) return Boolean;
+pragma Pure (Ada.Strings.Less_Case_Insensitive);
-In a review of a draft of this document, Randy B. said:
+Performs a lexicographic comparison of strings Left and Right, folded to
+lower case.
-The trick here, of course, is to ensure that you're evaluating as
-Universal_Integer. But I suppose that isn't perfect, since the expressions
-don't have to be static, and you could always use a type with more values
-than the largest integer type supported by the compiler.
-OTOH, you don't want to support more than Count_Type'Last elements, so
-giving an index with more is dubious.
+The library function Strings.Fixed.Less_Case_Insensitive has the
+following declaration:
-OT3H, not allowing Natural seems annoying.
+with Ada.Containers, Ada.Strings.Less_Case_Insensitive;
+function Ada.Strings.Fixed.Less_Case_Insensitive (Key : String)
+ return Boolean renames Ada.Strings.Less_Case_Insensitive;
+pragma Pure(Less_Case_Insensitive);
-Anyway, if you write the expressions as boolean conditionals, they're be
-evaluated as univeral integers. One idea is something like:
- subtype Capacity_Subtype is Count_Type
- range 0 .. Count_Type'Max (0,
- Boolean'Pos(Index_Type'Pos (Index_Type'Last) - Index_Type'Pos
-(Index_Type'First) + 1 > Count_Type'Pos(Count_Type'Last))*Count_Type'Last +
- Boolean'Pos(Index_Type'Pos (Index_Type'Last) - Index_Type'Pos
-(Index_Type'First) + 1 <= Count_Type'Pos(Count_Type'Last)*(Index_Type'Pos
-(Index_Type'Last) - Index_Type'Pos (Index_Type'First) + 1));
-Gosh that's awful. (And it still will raise an exception if Index_Type is a
-64-bit type on GNAT.)
+The generic library function Strings.Bounded.Less_Case_Insensitive has
+the following declaration:
-I guess we better leave this one for the full group.
-[END ARG]
+with Ada.Containers;
+generic
+ with package Bounded is
+ new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
+function Ada.Strings.Bounded.Less_Case_Insensitive
+ (Left, Right : Bounded.Bounded_String) return Boolean;
+pragma Preelaborate(Less_Case_Insensitive);
+Strings.Bounded.Less_Case_Insensitive is equivalent to the function call
+Strings.Less_Case_Insensitive (Bounded.To_String (Key));
-[ARG]
- procedure Move (Target : in out Vector; Source : in out Vector);
+The library function Strings.Unbounded.Less_Case_Insensitive has the
+following declaration:
-My notes say:
+with Ada.Containers;
+function Ada.Strings.Unbounded.Less_Case_Insensitive
+ (Left, Right : Unbounded_String) return Boolean;
+pragma Preelaborate(Equal_Case_Insensitive);
-RE-WRITE UNBOUNDED FORM TO INCLUDE A CALL TO RES_CAP, which means we
-could reuse the wording for unbounded form, therefore we don't need to
-say anything special here.
-
-Here's what the RM says now:
-
- "If Target denotes the same object as Source, then Move has no
- effect. Otherwise, Move first calls Clear (Target); then, each
- element from Source is removed from Source and inserted into Target
- in the original order. The length of Source is 0 after a successful
- call to Move."
-
-We change add a call to Reserve_Capacity to that description, subject
-to the following constraints:
-
-(1) In the bounded form, if the source length is greater than target
-capacity, we could prefer to raise Capacity_Error immediately (instead
-of clearning target as a side effect).
-
-(2) In the unbounded form, we prefer to clear first, and then reserve
-capacity. If you do in the other way around then the existing items
-are copied (in the reserve) and then immediately deleted (in the
-clear). Perhaps we only have to require the final effect (no items,
-and such-and-such capacity), but merely describe it in terms of a
-reserve followed by a clear.
-
-With that in mind, here's the revised description:
-
- "If Target denotes the same object as Source, then Move has no
- effect. Otherwise, Move first calls Target.Reserve_Capacity
- (Source.Length) and then Target.Clear; then, each element from
- Source is removed from Source and inserted into Target in the
- original order. The length of Source is 0 after a successful call
- to Move."
-
-If the original description of the Move operation is modified as above
-for the unbounded form, then there's probably nothing else we need to
-say for the bounded form (since Reserve_Capacity does what we want
-here).
+Strings.Unbounded.Less_Case_Insensitive is equivalent to the function
+call Strings.Less_Case_Insensitive (To_String (Key));
-[END ARG]
-Implementation Advice A.18.2(261/2) is deleted.
+A.18.1 Package Containers
-[ARG]
+Add the following after A.18.1(5/2):
-RLB: In the bounded form only? Or in unbounded and bounded
-forms?
+ Capacity_Error : exception;
-Alternatively, we would have to put as Implementation
-Advice in the bounded form:
-"The Implementation Advice for procedure Move is deleted."
+A.18.2 Package Containers.Vectors
-That's pretty weird.
+Add the following declarations after A.18.2(34/2):
-[END ARG]
+ procedure Assign (Target : in out Vector; Source : Vector);
- procedure Reserve_Capacity
- (Container : in out Vector;
- Capacity : Capacity_Subtype);
-
-If the specified Capacity is larger than the Container.Capacity, then
-Reserve_Capacity raises Capacity_Error. Otherwise, the operation has
-no effect.
+ function Copy (Source : Vector; Capacity : Count_Type := 0)
+ return Vector;
-[ARG]
+Add the following after A.18.2(147/2):
-The bounded form has a distinct description for Reserve_Capacity,
-because it can raise Capacity_Error. Where does this description go?
-[RLB: Under the description of Reserve_Capacity in the bounded forms,
-of course. Where else would it go?]
-
-More generally, no operations for the unbounded forms raise
-Capacity_Error. Do we need to specify this distinct behavior of the
-bounded forms?
+ procedure Assign (Target : in out Vector; Source : Vector);
-[END ARG]
+If Target denotes the same object as Source, the operation has no
+effect. If Source length is greater than Target capacity,
+Reserve_Capacity is called with the Source length as the capacity.
+Each element of Source is assigned to the corresponding elements of
+Target.
+ function Copy (Source : Vector; Capacity : Count_Type := 0)
+ return Vector;
-Bounded Doubly-Linked List
+Returns a vector whose elements are initialized from the corresponding
+elements of Source. If Capacity is 0, then the vector capacity is the
+length of Source; if Capacity is equal to or greater than
+Source.Length, the vector capacity is at least the specified value.
+Otherwise, the operation raises Capacity_Error.
-The language-defined generic package
-Containers.Bounded_Doubly_Linked_Lists provides a private type List
-and a set of operations. It provides the same operations as the
-package Containers.Doubly_Linked_Lists (see A.18.3), with the
-difference that internal storage is allocated statically.
+Add the following after A.18.2(89/2):
-Static Semantics
+If an operation attempts to modify the vector such that the position
+of the last element would be greater than Index_Type'Last, then the
+operation raises Constraint_Error.
+
+Modify A.18.2(115/2):
+{If the capacity of Container is already greater than or equal to
+Capacity then Reserve_Capacity has no effect. Otherwise, }
+Reserve_Capacity allocates [new internal data structures such]
+{additional storage as necessary to ensure} that the length of the
+resulting vector can become at least the value Capacity without
+requiring an additional call to Reserve_Capacity, and is large enough
+to hold the current length of Container. Reserve_Capacity then
+[copies the] {, as necessary, moves} elements into the new [data
+structures] {storage} and deallocates [the old data structures] {any
+storage no longer needed}. Any exception raised during allocation is
+propagated and Container is not modified.
+
+A.18.2(148/2) is replaced by the following:
+
+If Target denotes the same object as Source, then Move has no
+effect. Otherwise, Move first calls Target.Reserve_Capacity
+(Source.Length) and then Target.Clear; then, each element from Source
+is removed from Source and inserted into Target in the original
+order. The length of Source is 0 after a successful call to Move.
-The declaration of the generic library package
-Containers.Bounded_Doubly_Linked_Lists has the same contents as
-Containers.Doubly_Linked_Lists except:
+Add the following after A.18.2(93/2):
-The package has Pure categorization.
+ * it calls Assign with V as the Target parameter; or
-The list container type is declared with a discriminant that specifies the
-capacity, as follows:
- type List (Capacity : Count_Type) is tagged private;
+A.18.3 Package Containers.Doubly_Linked_Lists
Add the following declarations after A.18.3(17/2):
procedure Assign (Target : in out List; Source : List);
+
+ function Copy (Source : List) return List;
+
+Add the following after A.18.3(65/2):
- function Copy (Source : List; Capacity : Count_Type := 0)
- return List;
+ * it calls Assign with L as the Target parameter; or
Add the following after A.18.3(86/2):
procedure Assign (Target : in out List; Source : List);
If Target denotes the same object as Source, the operation has no
-effect. If Source length is greater than Target capacity, then the
-operation raises Capacity_Error, and Target is not modified.
-Otherwise, it clears Target, and then each element of Source is
-assigned to the matching element of Target.
-
- function Copy (Source : List; Capacity : Count_Type := 0)
- return List;
-
-Returns a list whose match the elements of Source. If Capacity is 0,
-then the list capacity is the length of Source; if Capacity is equal
-to or greater than Source.Length, the list capacity is at least the
-specified value. Otherwise, the operation raises Capacity_Error.
-
-[ARG]
-
-An issue with Assign here is that there's no Reserve_Capacity
-operation for lists, so we can't use the trick as we did for vectors
-to write a description that works for both the unbounded and bounded
-forms. Do we write distinct descriptions of Assign for the unbounded
-vs. bounded cases?
+effect. Otherwise, it clears Target, and each element of Source is
+assigned to the corresponding elements of Target.
-In general, operations that can raise Capacity_Error include:
-Append, Insert, Assign, Copy, Move, Prepend, List'Read, Splice
+ function Copy (Source : List) return List;
-[END ARG]
+Returns a list whose elements match the elements of Source.
- procedure Move (Target : in out List; Source : in out List);
+The description of Move in A.18.3(88/2) is replaced with:
Equivalent to Target.Assign (Source) followed by Source.Clear.
-[ARG]
-
-Will this description suffice for both the unbounded and bounded
-forms?
-
-[END ARG]
-
-Implementation Advice A.18.3(162/2) is deleted.
-
-[ARG]
-
-RLB: See notes under bounded vector.
-
-[END ARG]
- procedure Splice
- (Target : in out List;
- Before : Cursor;
- Source : in out List);
-
-If the sum of the Target length and Source length is greater than the
-Target capacity, then Splice raises Capacity_Error. Otherwise the
-elements from Source are moved to Target, immediately preceding
-position Before.
+A.18.4 Maps
-[ARG]
-
-We say "... are moved to ..." implying a call to Move. Do we need to
-say that explicitly?
-
-[END ARG]
+Add the following after A.18.4(10/2):
- procedure Splice
- (Target : in out List;
- Before : Cursor;
- Source : in out List;
- Position : in out Cursor);
+ * it calls Assign with M as the Target parameter; or
-If the Target length equals the Target capacity, then Splice raises
-Capacity_Error. Otherwise the element of Source designated by
-Position is moved to Target, immediately preceeding position Before.
+The description of Move in A.18.4(43/2) is replaced with:
-
-Maps
-
-Implementation Advice A.18.4(83/2) is deleted.
-
-
-Bounded Hashed Map
-
-The language-defined generic package Containers.Bounded_Hashed_Maps
-provides a private type Map and a set of operations. It provides the
-same operations as the package Containers.Hashed_Maps (see A.18.5),
-with the difference that internal storage is allocated statically.
-
-Static Semantics
-
-The declaration of the generic library package
-Containers.Bounded_Hashed_Maps has the same contents as
-Containers.Hashed_Maps except:
-
-The package has Pure categorization.
-
-The container type is declared with a discriminant that specifies both
-the capacity (number of elements) and modulous (number of distinct
-hash values) of the hash table as follows:
-
- type Map (Capacity : Count_Type; Modulus : Hash_Type) is tagged private;
+Equivalent to Target.Assign (Source) followed by Source.Clear.
- procedure Reserve_Capacity
- (Container : in out Map;
- Capacity : Count_Type);
-If the specified Capacity is larger than the Container.Capacity, then
-it raises Capacity_Error. Otherwise, the operation has no effect.
+A.18.5 Containers.Hashed_Maps
Add the following declarations after A.18.5(17/2):
procedure Assign (Target : in out Map; Source : Map);
-
- function Copy (Source : Map;
- Capacity : Count_Type := 0;
- Modulus : Hash_Type := 0) return Map;
-
-Add the following after A.18.5(53/2):
-
- procedure Assign (Target : in out Map; Source : Map);
-
-If Target denotes the same object as Source, the operation has no
-effect. If Source length is greater than Target capacity,
-Reserve_Capacity is called with the Source length as the capacity.
-Otherwise, it clears Target and inserts each key/element pair of
-Source into Target.
-
-[ARG]
-
-This is written very similar (i.e. in terms of Reserve_Capacity) to
-the description of Assign for the vector (with the intent that it work
-for both unbounded and bounded forms). Whatever we decide for vector
-should probably apply here as well.
-
-Note also we say "If Source length is greater than Target capacity,
-then Reserve_Capacity is called...". Do we need to bother with the
-if-clause? Reserve_Capacity is allowed to return more than requested,
-so the post-condition would be satified no matter what.
-
-[END ARG]
-
-
- function Copy (Source : Map;
- Capacity : Count_Type := 0;
- Modulus : Hash_Type := 0) return Map;
-
-Returns a map with key/element pairs copied from Source, and having a
-capacity and modulus determined as follows. If Capacity is 0, then
-the map capacity is the length of Source; if Capacity is equal to or
-greater than Source.Length, the map capacity is least the specified
-value; otherwise, the operation raises Capacity_Error. If the Modulus
-argument is 0, then the map modulus is the value returned by a call to
-Default_Modulus with the map capacity as its argument; otherwise the
-map modulus is the value of the Modulus argument.
-
-[ARG]
-
-We say "... pairs copied from Source ..." above: is this too
-tautological?
-
-[END ARG]
-
-[ARG]
-
-I have put the description of Assign and Copy here instead of in
-A.18.4 only because here I have two slightly different descriptions
-for hashed vs. ordered forms.
-
-[END ARG]
-
- procedure Move (Target : in out Map; Source : in out Map);
-
-Equivalent to Target.Assign (Source) followed by Source.Clear.
-
-[ARG]
-
-Here we describe Move in terms of Assign (which is in turn described
-in terms of Reserve_Capacity). Should we describe Move directly in
-terms of Reserve_Capacity, instead of in terms of Assign?
-
-[END ARG]
+ function Copy (Source : Map) return Map;
[ARG]
-
-Make this an implementation note?
-KNUTH SAYS YOU SHOULD GOLDEN RATIO FOR LOAD FACTOR
-SEE JOHN'S BOOK FOR SPECIFIC REF
+Does the unbounded form of hashed map (or hashed set) have additional
+parameters for Copy?
[END ARG]
+Add the following declaration after A.18.5(37/2):
function Default_Modulus (Capacity : Count_Type) return Hash_Type;
-
-Default_Modulus returns an implementation-defined value for the length
-of the buckets array (number of distinct hash values) for hashing the
-given capacity (maximum number of elements).
-
-[ARG]
-
-Use of "implementation-defined" is OK here?
-[END ARG]
+Add the following after A.18.2(61/2):
+ procedure Assign (Target : in out Map; Source : Map);
-Bounded Ordered Map
+If Target denotes the same object as Source, the operation has no
+effect. If Source length is greater than Target capacity,
+Reserve_Capacity is called with the Source length as the capacity.
+Each element of Source is then inserted into Target.
-The language-defined generic package Containers.Bounded_Ordered_Maps
-provides a private type Map and a set of operations. It provides the
-same operations as the package Containers.Ordered_Maps (see A.18.6),
-with the difference that internal storage is allocated statically.
+ function Copy (Source : Map) return Map;
-Static Semantics
+Returns a map whose keys and elements are initialized from the keys
+and elements of Source.
-The declaration of the generic library package
-Containers.Bounded_Ordered_Maps has the same contents as
-Containers.Ordered_Maps except:
-
-The package has Pure categorization.
+ function Default_Modulus (Capacity : Count_Type) return Hash_Type;
-The container type is declared with a discriminant that specifies the
-capacity (maximum number of elements) as follows:
+Default_Modulus returns an implementation-defined value for the number
+of distinct hash values to be used for the given capacity (maximum
+number of elements).
- type Map (Capacity : Count_Type) is tagged private;
+A.18.6 Containers.Ordered_Maps
Add the following declarations after A.18.6(16/2):
procedure Assign (Target : in out Map; Source : Map);
- function Copy (Source : Map;
- Capacity : Count_Type := 0) return Map;
+ function Copy (Source : Map) return Map;
Add the following after A.18.6(58/2):
procedure Assign (Target : in out Map; Source : Map);
If Target denotes the same object as Source, the operation has no
-effect. If Source length is greater than Target capacity, then the
-operation raises Capacity_Error. Otherwise, it clears Target and
-inserts each key/element pair of Source into Target.
-
-[ARG]
-
-This is similar to the case of lists (no Reserve_Capacity).
+effect. Each key/element pair of Source is assigned to the
+corresponding key/element pairs of Target.
-[END ARG]
+ function Copy (Source : Map) return Map;
- function Copy (Source : Map;
- Capacity : Count_Type := 0) return Map;
+Returns a map whose keys and elements are initialized from the
+corresponding keys and elements of Source.
-Returns a map with key/element pairs copied from Source, and having a
-capacity determined as follows. If Capacity is 0, then the map
-capacity is the length of Source; if Capacity is equal to or greater
-than Source.Length, the map capacity is at least the specified value;
-otherwise, the operation raises Capacity_Error.
+A.18.7 Sets
-[ARG]
+Add the following after A.18.7(10/2):
-Here's a list of operations that raise Capacity_Error:
-Assign, Copy, Include, Insert, Move, Map'Read, Reserve_Capacity
+ * it calls Assign with S as the Target parameter; or
-We just need to decide how to handle these, since there are
-differences between the unbounded and bounded forms.
+The description of Move in A.18.7(38/2) is replaced with:
-[END ARG]
+Equivalent to Target.Assign (Source) followed by Source.Clear.
- procedure Move (Target : in out Map; Source : in out Map);
-Equivalent to Target.Assign (Source) followed by Source.Clear.
+A.18.8 Containers.Hashed_Sets
+Add the following declarations after A.18.8(17/2):
-Sets
+ procedure Assign (Target : in out Set; Source : Set);
-Implementation Advice A.18.7(104/2) is deleted.
+ function Copy (Source : Set) return Set;
-Bounded Hashed Set
+Add the following declaration after A.18.8(49/2):
-The language-defined generic package Containers.Bounded_Hashed_Sets
-provides a private type Set and a set of operations. It provides the
-same operations as the package Containers.Hashed_Sets (see A.18.8),
-with the difference that internal storage is allocated statically.
+ function Default_Modulus (Capacity : Count_Type) return Hash_Type;
-Static Semantics
+Add the following after A.18.8(87/2):
-The declaration of the generic library package
-Containers.Bounded_Hashed_Sets has the same contents as
-Containers.Hashed_Sets except:
+ procedure Assign (Target : in out Set; Source : Set);
-The package has Pure categorization.
+If Target denotes the same object as Source, the operation has no
+effect. If Source length is greater than Target capacity,
+Reserve_Capacity is called with the Source length as the capacity.
+Each element of Source is then inserted into Target.
-The container type is declared with a discriminant that specifies both
-the capacity (number of elements) and modulous (number of distinct
-hash values) of the hash table as follows:
+ function Copy (Source : Set) return Set;
- type Set (Capacity : Count_Type; Modulus : Hash_Type) is tagged private;
+Returns a set whose elements are initialized from the elements of
+Source.
+ function Default_Modulus (Capacity : Count_Type) return Hash_Type;
- procedure Reserve_Capacity
- (Container : in out Map;
- Capacity : Count_Type);
+Default_Modulus returns an implementation-defined value for the number
+of distinct hash values to be used for the given capacity (maximum
+number of elements).
-If the specified Capacity is larger than the Container.Capacity, then
-it raises Capacity_Error. Otherwise, the operation has no effect.
+A.18.9 Containers.Ordered_Sets
-Add the following declarations after A.18.8(17/2):
+Add the following declarations after A.18.9(16/2):
procedure Assign (Target : in out Set; Source : Set);
- function Copy (Source : Set;
- Capacity : Count_Type := 0;
- Modulus : Hash_Type := 0) return Set;
+ function Copy (Source : Set) return Set;
-Add the following after A.18.8(75/2):
+Add the following after A.18.9(81/2):
procedure Assign (Target : in out Set; Source : Set);
If Target denotes the same object as Source, the operation has no
-effect. If Source length is greater than Target capacity,
-Reserve_Capacity is called with the Source length as the capacity.
-Otherwise, it clears Target and inserts each element of Source into
-Target.
+effect. Otherwise, each element of Source is assigned to the
+corresponding element of Target.
- function Copy (Source : Set;
- Capacity : Count_Type := 0;
- Modulus : Hash_Type := 0) return Set;
-
-Returns a set with elements copied from Source, and having a capacity
-and modulus determined as follows. If Capacity is 0, then the set
-capacity is the length of Source; if Capacity is equal to or greater
-than Source.Length, the set capacity is at least the specified value;
-otherwise, the operation raises Capacity_Error. If the Modulus
-argument is 0, then the set modulus is the value returned by a call to
-Default_Modulus with the set capacity as its argument; otherwise the
-set modulus is the value of the Modulus argument.
+ function Copy (Source : Set) return Set;
- procedure Move (Target : in out Set; Source : in out Set);
+Returns a set whose elements are initialized from the corresponding
+elements of Source.
-Equivalent to Target.Assign (Source) followed by Source.Clear.
- function Default_Modulus (Capacity : Count_Type) return Hash_Type;
+A.18.16 Array Sorting
-Default_Modulus returns an implementation-defined value for the length
-of the buckets array (number of distinct hash values) for hashing the
-given capacity (maximum number of elements).
+A.18.16 (1/2) is replaced by the following:
-[ARG]
+The language-defined generic procedures Containers.Generic_Array_Sort,
+Containers.Generic_Constrained_Array_Sort, and Containers.Generic_Sort
+provide sorting on arbitrary array types.
-Use of "implementation-defined" is OK here?
+Add the following declarations after A.18.16 (9/2):
-[END ARG]
+generic
+ type Index_Type is (<>);
+ with function Before (Left, Right : Index_Type) return Boolean;
+ with procedure Swap (Left, Right : Index_Type);
+procedure Ada.Containers.Generic_Sort (First, Last : Index_Type'Base);
+pragma Pure (Ada.Containers.Generic_Sort);
-Bounded Ordered Set
+Reorders the elements of an indexable structure, over the range First
+.. Last, such that the elements are sorted smallest first as
+determined by the generic formal Before function provided. Generic
+formal Before compares the elements having the given indices, and
+generic formal Swap exchanges the values of the indicated
+elements. Any exception raised during evaluation of Before or Swap is
+propagated.
-The language-defined generic package Containers.Bounded_Ordered_Sets
-provides a private type Set and a set of operations. It provides the
-same operations as the package Containers.Ordered_Sets (see A.18.9),
-with the difference that internal storage is allocated statically.
+The actual function for the generic formal function Before of
+Generic_Sort is expected to return the same value each time it is
+called with a particular pair of element values. It should define a
+strict weak ordering relationship (see A.18); it should not modify the
+elements. If the actual for Before behaves in some other manner, the
+behavior of Generic_Sort is unspecified. How many times the
+Generic_Sort calls Before or Swap is unspecified.
-Static Semantics
-The declaration of the generic library package
-Containers.Bounded_Ordered_Sets has the same contents as
-Containers.Ordered_Sets except:
+A.18.17 Containers.Indefinite_Holders (see AI05-0069-1)
-The package has Pure categorization.
+Add the following declarations after A.18.17(15/3): [Before Move]
-The container type is declared with a discriminant that specifies the
-capacity (maximum number of elements) as follows:
+ procedure Assign (Target : in out Holder; Source : Holder);
- type Set (Capacity : Count_Type) is tagged private;
+ function Copy (Source : Holder) return Holder;
-Add the following declarations after A.18.9(16/2):
+Add the following after A.18.17(44/3):
- procedure Assign (Target : in out Set; Source : Set);
+ procedure Assign (Target : in out Holder; Source : Holder);
- function Copy (Source : Set;
- Capacity : Count_Type := 0) return Set;
+If Target denotes the same object as Source, the operation has no
+effect. If Source is empty, Clear (Target) is called. Otherwise,
+Replace_Element (Target, Element (Source)) is called.
-Add the following after A.18.9(81/2):
+ function Copy (Source : Holder) return Holder;
- procedure Assign (Target : in out Set; Source : Set);
+If Source is empty, returns an empty holder; otherwise, returns
+To_Holder (Element (Source)).
-If Target denotes the same object as Source, the operation has no
-effect. If Source length is greater than Target capacity, then the
-operation raises Capacity_Error. Otherwise, it clears Target and
-inserts each element of Source into Target.
+A.18.18 The Package Containers.Bounded_Vectors
- function Copy (Source : Set;
- Capacity : Count_Type := 0) return Set;
+The language-defined generic package Containers.Bounded_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),
+with the difference that the maximum storage is bounded.
-Returns a set with elements copied from Source, and having a capacity
-determined as follows. If Capacity is 0, then the set capacity is the
-length of Source; if Capacity is equal to or greater than
-Source.Length, the set capacity is at least the specified value;
-otherwise, the operation raises Capacity_Error.
+Static Semantics
- procedure Move (Target : in out Set; Source : in out Set);
+The declaration of the generic library package
+Containers.Bounded_Vectors has the same contents and semantics as
+Containers.Vectors except:
-Equivalent to Target.Assign (Source) followed by Source.Clear. Source
-is cleared.
+ * pragma Preelaborate is replaced with pragma Pure
-Protected Queues
+ AARM implementation note: Package Containers.Bounded_Vectors
+ cannot depend on package Ada.Finalization (because that package
+ has Preelaborate categorization).
-[ARG]
-Should we have priority queues too? (Steve B. suggested something
-like fibbonacci heaps as implementation data structure.)
-[END ARG]
+ * The type Vector is declared with a discriminant that specifies
+ the capacity:
-The language-defined generic package Containers.Queues provides
-interface type Queue, and a set of operations for that type.
+ type Vector (Capacity : Count_Type) is tagged private;
-generic
- type Element_Type is private;
+ * The type Vector does not need finalization if and only type
+ Element_Type does not need finalization.
-package Ada.Containers.Queues is
- pragma Pure;
+ * In function Copy, if the Capacity parameter is equal to or
+ greater than Source.Length, the vector capacity exactly equals
+ the value of the Capacity parameter.
- type Queue is synchronized interface;
+ * The description of Reserve_Capacity is replaced by:
- procedure Enqueue
- (Container : in out Queue;
- New_Item : Element_Type) is abstract;
- pragma Implemented (Enqueue, By_Entry);
+ If the specified Capacity is larger than the Container.Capacity,
+ then Reserve_Capacity raises Capacity_Error. Otherwise, the
+ operation has no effect.
- procedure Dequeue
- (Container : in out Queue;
- Element : out Element_Type) is abstract;
- pragma Implemented (Dequeue, By_Entry);
+ * The implementation advice for procedure Move does not apply.
- function Is_Empty (Container : Queue) return Boolean is abstract;
+[Editor's note: Matt had "The implementation advice in A.18.2(261/2)
+does not apply", but of course wording cannot refer to paragraph numbers
+(the ISO version doesn't have them). I made the above replacement,
+but I'm not happy with it - 262/2 applies to Move and we don't want
+to eliminate it.].
- function Is_Full (Container : Queue) return Boolean is abstract;
+ * The implementation advice includes an additional item, stating
+ that bounded vector objects should not be implemented by
+ implicit pointers or dynamic allocation.
-end Ada.Containers.Queues;
+ * Vector'Write writes only Vector.Length elements to the stream.
+ Vector'Read reads only Vector.Length elements from the stream.
+A.18.19 Package Containers.Bounded_Doubly_Linked_Lists
-Interface Queue specifies a first-in, first-out queue.
+The language-defined generic package
+Containers.Bounded_Doubly_Linked_Lists provides a private type List
+and a set of operations. It provides the same operations as the
+package Containers.Doubly_Linked_Lists (see A.18.3), with the
+difference that the maximum storage is bounded.
- procedure Enqueue
- (Container : in out Queue;
- New_Item : Element_Type) is abstract;
+Static Semantics
-Copies New_Item onto the tail of the queue. If Is_Full is True, then
-Enqueue waits on the entry for storage to become available.
+The declaration of the generic library package
+Containers.Bounded_Doubly_Linked_Lists has the same contents and
+semantics as Containers.Doubly_Linked_Lists except:
- procedure Dequeue
- (Container : in out Queue;
- Element : out Element_Type) is abstract;
+ * pragma Preelaborate is replaced with pragma Pure
-Removes the element at the head of the queue, and returns a copy of
-the element. Is Is_Empty is True, then Dequeue waits on the entry for
-an item to become available.
+ AARM implementation note: Package
+ Containers.Bounded_Doubly_Linked_Lists cannot depend on
+ package Ada.Finalization (because that package has Preelaborate
+ categorization).
- function Is_Empty (Container : Queue) return Boolean is abstract;
+ * The type List is declared with a discriminant that specifies the
+ capacity:
-Returns an indication of whether the queue contains items.
+ type List (Capacity : Count_Type) is tagged private;
- function Is_Full (Container : Queue) return Boolean is abstract;
+ * The type List does not need finalization if and only type
+ Element_Type does not need finalization.
-Returns an indication of whether the queue is able to contain more
-items.
+ * The allocation of internal storage includes a check that the
+ capacity is not exceeded, and Capacity_Error is raised if this
+ check fails.
+ * In procedure Assign, if Source length is greater than Target
+ capacity, then Capacity_Error is raised.
-Bounded Queues
+ * Function Copy is declared as follows:
-The language-defined generic package Containers.Bounded_Queues
-provides type Queue, which implements the interface type
-Containers.Queues.Queue.
+ function Copy (Source : List; Capacity : Count_Type := 0)
+ return List;
-with Ada.Containers.Queues;
-generic
- with package Queues is new Ada.Containers.Queues (<>);
+ If Capacity is 0, then the list capacity is the length of
+ Source; if Capacity is equal to or greater than Source.Length,
+ the list capacity equals the value of the Capacity parameter;
+ otherwise, the operation raises Capacity_Error.
-package Ada.Containers.Bounded_Queues is
- pragma Pure;
+ * The implementation advice for procedure Move does not apply.
- type Queue (Capacity : Count_Type) is
- synchronized new Queues.Queue with private;
+ * In three-parameter procedure Splice whose Source has type List,
+ if the sum of the Target length and Source
+ length is greater than the Target capacity, then Splice raises
+ Capacity_Error.
-private
+ [Editor's note: This is referring to A.18.3(112/2), but of
+ course we can't say that.]
- -- not specified by the language
+ * In four-parameter procedure Splice, if the
+ Target length equals the Target capacity, then Splice raises
+ Capacity_Error.
-end Ada.Containers.Bounded_Queues;
+ [Editor's note: This is referring to A.18.3(114/2).]
-The bounded queue specifies a queue with finite capacity. Is_Full
-returns True when the length (the current number of items) equals the
-capacity.
+ * List'Write writes only List.Length elements to the stream.
+ List'Read reads only List.Length elements from the stream.
-Unbounded Queues
+A.18.20 Containers.Bounded_Hashed_Maps
-The language-defined generic package Containers.Unbounded_Queues
-provides type Queue, which implements the interface type
-Containers.Queues.Queue.
+The language-defined generic package Containers.Bounded_Hashed_Maps
+provides a private type Map and a set of operations. It provides the
+same operations as the package Containers.Hashed_Maps (see A.18.5),
+with the difference that the maximum storage is bounded.
-with Ada.Containers.Queues;
-generic
- with package Queues is new Ada.Containers.Queues (<>);
+Static Semantics
-package Ada.Containers.Unbounded_Queues is
- pragma Preelaborate;
+The declaration of the generic library package
+Containers.Bounded_Hashed_Maps has the same contents and semantics as
+Containers.Hashed_Maps except:
- type Queue is synchronized new Queues.Queue with private;
+ * pragma Preelaborate is replaced with pragma Pure
-private
+ AARM implementation note: Package Containers.Bounded_Hashed_Maps
+ cannot depend on package Ada.Finalization (because that package
+ has Preelaborate categorization).
- -- not specified by the language
+ * The type Map is declared with a discriminant that specifies both
+ the capacity (number of elements) and modulus (number of
+ distinct hash values) of the hash table as follows:
+
+ type Map (Capacity : Count_Type;
+ Modulus : Hash_Type) is tagged private;
-end Ada.Containers.Unbounded_Queues;
+ * The type Map does not need finalization if and only type
+ Key_Type or type Element_Type does not need finalization.
-The unbounded queue specifies a queue with no specified maximum
-capacity. Is_Full always returns False. Enqueue will never block
-(although it can fail for other reasons, e.g. storage is exhausted).
+ * The description of Reserve_Capacity is replaced
+ by:
+ If the specified Capacity is larger than the Container.Capacity,
+ then Reserve_Capacity raises Capacity_Error. Otherwise, the
+ operation has no effect.
-Generic_Sort
+ * The function Copy is replaced with:
-The generic library procedure Containers.Generic_Sort has the
-following declaration:
+ function Copy (Source : Map;
+ Capacity : Count_Type := 0;
+ Modulus : Hash_Type := 0) return Map;
-generic
- type Index_Type is (<>);
- with function Less (Left, Right : Index_Type) return Boolean is <>;
- with procedure Swap (Left, Right : Index_Type) is <>;
+ Returns a map with key/element pairs initialized from the values
+ in Source. If Capacity is 0, then the map capacity is the
+ length of Source; if Capacity is equal to or greater than
+ Source.Length, the map capacity is the value of the Capacity
+ parameter; otherwise, the operation raises Capacity_Error. If
+ the Modulus argument is 0, then the map modulus is the value
+ returned by a call to Default_Modulus with the map capacity as
+ its argument; otherwise the map modulus is the value of the
+ Modulus parameter.
-procedure Ada.Containers.Generic_Sort (First, Last : Index_Type'Base);
-pragma Pure (Ada.Containers.Generic_Sort);
+ * The implementation advice for procedure Move does not apply.
-Reorders the elements of an indexable container, over the range First
-.. Last, such that the elements are sorted smallest first as
-determined by the generic formal Less function provided. Generic
-formal Less compares the elements having the given indices, and
-generic formal Swap exchanges the values of the indicated
-elements. Any exception raised during evaluation of Less or Swap is
-propagated.
+ * Map'Write writes only Map.Length elements to the stream.
+ Map'Read reads only Map.Length elements from the stream.
-The actual function for the generic formal function Less of
-Generic_Sort is expected to return the same value each time it is
-called with a particular pair of element values. It should define a
-strict weak ordering relationship (see A.18); it should not modify the
-elements. If the actual for Less behaves in some other manner, the
-behavior of Generic_Sort is unspecified. How many times the
-Generic_Sorts calls Less or Swap is unspecified.
-Case-Insensitive Operations
+A.18.21 Containers.Bounded_Ordered_Maps
-The library function Strings.Hash_Case_Insensitive has the following
-declaration:
+The language-defined generic package Containers.Bounded_Ordered_Maps
+provides a private type Map and a set of operations. It provides the
+same operations as the package Containers.Ordered_Maps (see A.18.6),
+with the difference that the maximum storage is bounded.
-with Ada.Containers;
-function Ada.Strings.Hash_Case_Insensitive
- (Key : String) return Containers.Hash_Type;
-pragma Pure (Ada.Strings.Hash_Case_Insensitive);
+Static Semantics
-Returns an implementation-defined value which is a function of the value
-of Key, folded to lower case. If A and B are strings such that A equals
-B, Hash_Case_Insensitive(A) equals Hash_Case_Insensitive(B).
+The declaration of the generic library package
+Containers.Bounded_Ordered_Maps has the same contents and semantics as
+Containers.Ordered_Maps except:
+ * pragma Preelaborate is replaced with pragma Pure
-The library function Strings.Fixed.Hash_Case_Insensitive has the
-following declaration:
+ AARM implementation note: Package Containers.Bounded_Ordered_Maps
+ cannot depend on package Ada.Finalization (because that package
+ has Preelaborate categorization).
-with Ada.Containers, Ada.Strings.Hash_Case_Insensitive;
-function Ada.Strings.Fixed.Hash_Case_Insensitive (Key : String)
- return Containers.Hash_Type renames Ada.Strings.Hash_Case_Insensitive;
-pragma Pure(Hash_Case_Insensitive);
+ * The type Map is declared with a discriminant that specifies the
+ capacity (maximum number of elements) as follows:
+ type Map (Capacity : Count_Type) is tagged private;
-The generic library function Strings.Bounded.Hash_Case_Insensitive has
-the following declaration:
+ * The type Map does not need finalization if and only type
+ Key_Type or type Element_Type does not need finalization.
-with Ada.Containers;
-generic
- with package Bounded is
- new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
-function Ada.Strings.Bounded.Hash_Case_Insensitive
- (Key : Bounded.Bounded_String) return Containers.Hash_Type;
-pragma Preelaborate(Hash_Case_Insensitive);
+ * In procedure Assign, if Source length is greater than Target
+ capacity, then Capacity_Error is raised.
-Strings.Bounded.Hash_Case_Insensitive is equivalent to the function call
-Strings.Hash_Case_Insensitive (Bounded.To_String (Key));
+ * The function Copy is replaced with:
+ function Copy (Source : Map;
+ Capacity : Count_Type := 0) return Map;
-The library function Strings.Unbounded.Hash_Case_Insensitive has the
-following declaration:
+ Returns a map with key/element pairs initialized from the values
+ in Source. If Capacity is 0, then the map capacity is the
+ length of Source; if Capacity is equal to or greater than
+ Source.Length, the map capacity is the specified value;
+ otherwise, the operation raises Capacity_Error.
-with Ada.Containers;
-function Ada.Strings.Unbounded.Hash_Case_Insensitive
- (Key : Unbounded_String) return Containers.Hash_Type;
-pragma Preelaborate(Hash_Case_Insensitive);
+ * The implementation advice for procedure Move does not apply.
-Strings.Unbounded.Hash_Case_Insensitive is equivalent to the function
-call Strings.Hash_Case_Insensitive (To_String (Key));
+ * Map'Write writes only Map.Length elements to the stream.
+ Map'Read reads only Map.Length elements from the stream.
-The library function Strings.Equal_Case_Insensitive has the following
-declaration:
+A.18.22 Containers.Bounded_Hashed_Sets
-function Ada.Strings.Equal_Case_Insensitive
- (Left, Right : String) return Boolean;
-pragma Pure (Ada.Strings.Equal_Case_Insensitive);
+The language-defined generic package Containers.Bounded_Hashed_Sets
+provides a private type Set and a set of operations. It provides the
+same operations as the package Containers.Hashed_Sets (see A.18.8),
+with the difference that the maximum storage is bounded.
-Compares strings Left and Right, folded to lower case, for equality.
+Static Semantics
-The library function Strings.Fixed.Equal_Case_Insensitive has the
-following declaration:
+The declaration of the generic library package
+Containers.Bounded_Hashed_Sets has the same contents and semantics as
+Containers.Hashed_Sets except:
-with Ada.Containers, Ada.Strings.Equal_Case_Insensitive;
-function Ada.Strings.Fixed.Equal_Case_Insensitive (Key : String)
- return Boolean renames Ada.Strings.Equal_Case_Insensitive;
-pragma Pure(Equal_Case_Insensitive);
+ * pragma Preelaborate is replaced with pragma Pure
+ AARM implementation note: Package Containers.Bounded_Hashed_Sets
+ cannot depend on package Ada.Finalization (because that package
+ has Preelaborate categorization).
-The generic library function Strings.Bounded.Equal_Case_Insensitive has
-the following declaration:
+ * The type Set is declared with a discriminant that specifies both
+ the capacity (number of elements) and modulus (number of
+ distinct hash values) of the hash table as follows:
-with Ada.Containers;
-generic
- with package Bounded is
- new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
-function Ada.Strings.Bounded.Equal_Case_Insensitive
- (Left, Right : Bounded.Bounded_String) return Boolean;
-pragma Preelaborate(Equal_Case_Insensitive);
+ type Set (Capacity : Count_Type;
+ Modulus : Hash_Type) is tagged private;
-Strings.Bounded.Equal_Case_Insensitive is equivalent to the function call
-Strings.Equal_Case_Insensitive (Bounded.To_String (Key));
+ * The type Set does not need finalization if and only type
+ Element_Type does not need finalization.
+ * The description of Reserve_Capacity is replaced by:
-The library function Strings.Unbounded.Equal_Case_Insensitive has the
-following declaration:
+ If the specified Capacity is larger than the Container.Capacity,
+ then Reserve_Capacity raises Capacity_Error. Otherwise, the
+ operation has no effect.
-with Ada.Containers;
-function Ada.Strings.Unbounded.Equal_Case_Insensitive
- (Left, Right : Unbounded_String) return Boolean;
-pragma Preelaborate(Equal_Case_Insensitive);
+ * The function Copy is replaced with:
-Strings.Unbounded.Equal_Case_Insensitive is equivalent to the function
-call Strings.Equal_Case_Insensitive (To_String (Key));
+ function Copy (Source : Set;
+ Capacity : Count_Type := 0;
+ Modulus : Hash_Type := 0) return Set;
+ Returns a set whose elements are initialized from the values in
+ Source. If Capacity is 0, then the set capacity is the length
+ of Source; if Capacity is equal to or greater than
+ Source.Length, the set capacity is the value of the Capacity
+ parameter; otherwise, the operation raises Capacity_Error. If
+ the Modulus argument is 0, then the set modulus is the value
+ returned by a call to Default_Modulus with the set capacity as
+ its argument; otherwise the set modulus is the value of the
+ Modulus parameter.
-The library function Strings.Less_Case_Insensitive has the following
-declaration:
+ * The implementation advice for procedure Move does not apply.
-function Ada.Strings.Less_Case_Insensitive
- (Left, Right : String) return Boolean;
-pragma Pure (Ada.Strings.Less_Case_Insensitive);
+ * Set'Write writes only Set.Length elements to the stream.
+ Set'Read reads only Set.Length elements from the stream.
-Performs a lexicographic comparison of strings Left and Right, folded to
-lower case.
+A.18.23 Containers.Bounded_Ordered_Sets
-The library function Strings.Fixed.Less_Case_Insensitive has the
-following declaration:
+The language-defined generic package Containers.Bounded_Ordered_Sets
+provides a private type Set and a set of operations. It provides the
+same operations as the package Containers.Ordered_Sets (see A.18.9),
+with the difference that the maximum storage is bounded.
-with Ada.Containers, Ada.Strings.Less_Case_Insensitive;
-function Ada.Strings.Fixed.Less_Case_Insensitive (Key : String)
- return Boolean renames Ada.Strings.Less_Case_Insensitive;
-pragma Pure(Less_Case_Insensitive);
+Static Semantics
+The declaration of the generic library package
+Containers.Bounded_Ordered_Sets has the same contents and semantics as
+Containers.Ordered_Sets except:
-The generic library function Strings.Bounded.Less_Case_Insensitive has
-the following declaration:
+ * pragma Preelaborate is replaced with pragma Pure
-with Ada.Containers;
-generic
- with package Bounded is
- new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
-function Ada.Strings.Bounded.Less_Case_Insensitive
- (Left, Right : Bounded.Bounded_String) return Boolean;
-pragma Preelaborate(Less_Case_Insensitive);
+ AARM implementation note: package Containers.Bounded_Ordered_Sets
+ cannot depend on package Ada.Finalization (because that package
+ has Preelaborate categorization).
-Strings.Bounded.Less_Case_Insensitive is equivalent to the function call
-Strings.Less_Case_Insensitive (Bounded.To_String (Key));
+ * The type Set is declared with a discriminant that specifies the
+ capacity (maximum number of elements) as follows:
+ type Set (Capacity : Count_Type) is tagged private;
-The library function Strings.Unbounded.Less_Case_Insensitive has the
-following declaration:
+ * The type Set does not need finalization if and only type
+ Element_Type does not need finalization.
-with Ada.Containers;
-function Ada.Strings.Unbounded.Less_Case_Insensitive
- (Left, Right : Unbounded_String) return Boolean;
-pragma Preelaborate(Equal_Case_Insensitive);
+ * In procedure Assign, if Source length is greater than Target
+ capacity, then Capacity_Error is raised.
-Strings.Unbounded.Less_Case_Insensitive is equivalent to the function
-call Strings.Less_Case_Insensitive (To_String (Key));
+ * The function Copy is replaced with:
+
+ function Copy (Source : Set;
+ Capacity : Count_Type := 0) return Set;
+
+ Returns a set whose elements are initialized from the values in
+ Source. If Capacity is 0, then the set capacity is the length
+ of Source; if Capacity is equal to or greater than
+ Source.Length, the set capacity is the specified value;
+ otherwise, the operation raises Capacity_Error.
+
+ * The implementation advice for procedure Move does not apply.
+
+ * Set'Write writes only Set.Length elements to the stream.
+ Set'Read reads only Set.Length elements from the stream.
!discussion
The forms added were decided at the September subcommittee meeting in New York.
+See also AI05-0069-1 (Indefinite_Holder), AI05-0136-1 (Multiway_Trees), and
+AI05-0159-1 (Queues)
We need to copy some info from the notes from that meeting here to justify
these choices better.
Questions? Ask the ACAA Technical Agent