Rationale for Ada 2005: 6a Containers
RUSTOPBACKNEXT
ENG |
Appendix Container summary
@ In order to save space the following abbreviations are used in the table:T | container type eg Map | H_T | Hash_Type |
C : T | Container : container type | I_T | Index_Type |
P : C | Position : Cursor | K_T | Key_Type |
L, R | Left, Right | Ex_Index | Extended_Index |
C_T | Count_Type | B | Boolean |
E_T | Element_Type |
Rationale for Ada 2005: 6a Containers
ENGRUSTOPBACKNEXTПриложение Сводная таблица контейнеров
@ В таблице для экономии места приняты следующие сокращения:
T | container type eg Map | H_T | Hash_Type |
C : T | Container : container type | I_T | Index_Type |
P : C | Position : Cursor | K_T | Key_Type |
L, R | Left, Right | Ex_Index | Extended_Index |
C_T | Count_Type | B | Boolean |
E_T | Element_Type |
@ а также Index - означает, что другая подпрограмма существует с подобными параметрами за исключением того, что первые параметры имеют тип Vector и Index_Type (или Extended_Index), а не те, которые вовлекают курсоры.
@ а также Key и Element относятся к картам и наборам соответственно.
vectors | lists | hashed maps |
ordered maps |
hashed sets |
ordered sets |
|
generic | Y | Y | Y | Y | Y | Y |
type Index_Type is range <> | Y | |||||
type Key_Type is private; | Y | Y | ||||
type Element_Type is private; | Y | Y | Y | Y | Y | Y |
with function Hash ( ... ) return Hash_Type; | on Key | on Element | ||||
with function Equivalent_... (L, R : ...) return Boolean; | on Key | on Element | ||||
with function "<" (L, R : ... ) return Boolean is <> | on Key | on Element | ||||
with function "=" (L, R : E_T) return B is <> | Y | Y | Y | Y | Y | Y |
package Ada.Containers.... is | Vectors | Doubly_ Linked_ Lists |
Hashed_ Maps |
Ordered_ Maps |
Hashed_ Sets |
Ordered_ Sets |
pragma Preelaborate ( ... ); | Y | Y | Y | Y | Y | Y |
function Equivalent_...(L, R: ...) return Boolean; | on Key | on Element | ||||
subtype Extended_Index ... No_Index: constant Ex_Ind := Ex_Ind'First; |
Y | |||||
type T is tagged private; pragma Preelaborable_Initialization(T); |
Vector | List | Map | Map | Set | Set |
type Cursor is private; pragma Preelaborable_Initialization(Cursor); |
Y | Y | Y | Y | Y | Y |
Empty_T: constant T; | Vector | List | Map | Map | Set | Set |
No_Element: constant Cursor; | Y | Y | Y | Y | Y | Y |
function "=" (Left, Right: T) return Boolean; | Y | Y | Y | Y | Y | Y |
function Equivalent_Sets(L, R: Set) return Boolean; function To_Set(New_Item: E_T) return Set; |
Y | Y | ||||
function To_Vector(Length: C_T) return Vector; function To_Vector(New_Item: E_T; Length: C_T) return Vector; |
Y | |||||
function "&" (L, R: Vector) return Vector; function "&" (L: Vector; R: E_T) return Vector; function "&" (L: E_T; R: Vector) return Vector; function "&" (L, R: E_T) return Vector; |
Y | |||||
function Capacity(C: T) return C_T; procedure Reserve_Capacity(C: T; Capacity: C_T); |
Y | Y | Y | |||
function Length(C: T) return Count_Type; | Y | Y | Y | Y | Y | Y |
procedure Set_Length(C: in out T; Length: in C_T); | Y | |||||
function Is_Empty(C: T) return B; procedure Clear(C: in out T); |
Y | Y | Y | Y | Y | Y |
function To_Cursor(C: Vector; Index: Ex_Ind) return Cursor; function To_Index(P: C) return Ex_Ind; |
Y | |||||
function Key(P: C) return K_T; | Y | Y | ||||
function Element(P: C) return E_T; | Y also index |
Y | Y | Y | Y | Y |
procedure Replace_Element(C: in out T; P: C; New_Item: E_T); | Y also index |
Y | Y | Y | Y | Y |
procedure Query_Element(P: C; Process: not null acc proc( ... ) ); | in Element also Index |
in Element | in Key in Element |
in Key in Element |
in Element | in Element |
procedure Update_Element(C: in out T; P: C; Process: not null acc proc( ... ) ); | in out Elem alse Index |
in out Element |
in Key in out Elem |
|||
procedure Move(Target, Source: in out T); | Y | Y | Y | Y | Y | Y |
procedure Insert(C: in out Vector; Before: Ex_Ind; New_Item: Vector); procedure Insert(C: in out Vector; Before: Cursor; New_Item: Vector); procedure Insert(C: in out Vector; Before: Cursor; New_Item: Vector; Position: out Cursor); |
Y | |||||
procedure Insert(C: in out T; Before: C; New_Item: E_T; Count: C_T := 1); | Y also Index |
Y | ||||
procedure Insert(C: in out T; Before: C; New_Item: E_T; Position: out Cursor; Count: C_T := 1); | Y | Y | ||||
procedure Insert(C: in out T; Before: C; Position: out Cursor; Count: C_T := 1); element has default value |
Y also Index |
Y | ||||
procedure Insert(C: in out T; Key: K_T; New_Item: E_T; Position: out Cursor; Inserted: out B); | Y | Y | Y (no key) | Y (no key) | ||
procedure Insert(C: in out T; Key: K_T; Position: out Cursor; Inserted: out B); element has default value |
Y | Y | ||||
procedure Insert(C: in out T; Key: K_T; New_Item: E_T); | Y | Y | Y (no key) | Y (no key) | ||
procedure Prepend(C: in out Vector; New_Item: Vector); | Y | |||||
procedure Prepend(C: in out T; New_Item: E_T; Count: C_T := 1); | Y | Y | ||||
procedure Append(C: in out Vector; New_Item: Vector); | Y | |||||
procedure Append(C: in out T; New_Item: E_T; Count: C_T := 1); | Y | Y | ||||
procedure Insert_Space(C: in out V; Before: Cursor; Position: out Cursor; Count: C_T := 1); | Y also Index |
|||||
procedure Include(C: in out T; Key: Key_Type; New_Item: E_T); | Y | Y | Y (no key) | Y (no key) | ||
procedure Replace(C: in out T; Key: Key_Type; New_Item: E_T); | Y | Y | Y (no key) | Y (no key) | ||
procedure Exclude(C: in out T; Key: Key_Type); | Y | Y | Y (inem not key) |
Y (item not key) |
||
procedure Delete(C: in out T; P: in out C; Count: C_T := 1); | Y also Index |
Y | Y (no count) also Key |
Y (no count) also Element |
Y | Y |
procedure Delete_First(C: in out T; Count: C_T := 1); procedure Delete_Last(C: in out T; Count: C_T := 1); |
Y | Y | Y (no count) | Y (no count) | ||
procedure Reverse_Elements(C: in out T); | Y | Y | ||||
procedure Swap(C: in out T; I, J: Cursor); | Y also Index |
Y | ||||
procedure Swap_Links(C: in out List; I, J: Cursor); | Y | |||||
procedure Splice(Target: in out List; Before: Cursor; Source: in out List); procedure Splice(Target: in out List; Before: Cursor; Source: in out List; Position: in out Cursor); procedure Splice(Container: in out List; Before: Cursor; Position: in out Cursor); |
Y | |||||
procedure Union(Target: in out Set; Source: Set); function Union(L, R: Set) return Set; function "or" (L, R: Set) return Set renames Union; |
Y | Y | ||||
procedure Intersection(Target: in out Set; Source: Set); function Intersection(L, R: Set) return Set; function "and" (L, R: Set) return Set renames Intersection; |
Y | Y | ||||
procedure Difference(Target: in out Set; Source: Set); function Difference(L, R: Set) return Set; function "–" (L, R: Set) return Set renames Difference; |
Y | Y | ||||
procedure Symmetric_Difference(Target: in out Set; Source: Set); function Symmetric_Difference (L, R: Set) return Set; function "xor" (L, R: Set) return Set renames Symmetric_Difference; |
Y | Y | ||||
function Overlap(L, R: Set) return Boolean; function Is_Subset(Subset: Set; Of_Set: Set) return B; |
Y | Y | ||||
function First_Index(C: T) return Index_Type; | Y | |||||
function First(C: T) return Cursor; | Y | Y | Y | Y | Y | Y |
function First_Element(C: T) return Element_Type; | Y | Y | Y | Y | ||
function First_Key(C: T) return Key_Type; | Y | |||||
function Last_Index(C: T) return Ex_Ind; | Y | |||||
function Last(C: T) return Cursor; | Y | Y | Y | Y | ||
function Last_Element(C: T) return Element_Type; | Y | Y | Y | Y | ||
function Last_Key(C: T) return Key_Type; | Y | |||||
function Next(P: C) return Cursor; procedure Next(P: in out C); |
Y | Y | Y | Y | Y | Y |
function Previous(P: C) return Cursor; procedure Previous(P: in out C); |
Y | Y | Y | Y | ||
function Find_Index(C: T; Item: E_T; Index: I_T := I_T'First) return Ex_Ind; | Y | |||||
function Find(C: T; ... ; P: C := No_Element) return Cursor; | Element | Element | Key (no position) |
Key (no position) |
Element (no position) |
Element (no position) |
function Element(C: T; Key: K_T) return E_T; | Y | Y | ||||
function Reverse_Find_Index(C: T; Item: E_T; Index: I_T := I_T'First) return Ex_Ind; | Y | |||||
function Reverse_Find(C: T; ... ; P: C := No_Element) return Cursor; | Element | Element | ||||
function Floor(C: T; ...) return Cursor; function Ceiling(C: T; ...) return Cursor; |
Key: K_T | Item: E_T | ||||
function Contains(C: T; ...) return Boolean; | Element | Element | Key | Key | Element | Element |
function Has_Element(P: C) return Boolean; | Y | Y | Y | Y | Y | Y |
function Equivalent_... (L, R: Cursor) return Boolean; function Equivalent_... (L: Cursor; R:...) return Boolean; function Equivalent_... (L:...; R: Cursor) return Boolean; |
Keys | Elements | ||||
function "<" (L, R: Cursor) return Boolean; function ">" (L, R: Cursor) return Boolean; function "<" (L, Cursor; R: ...) return Boolean; function ">" (L, Cursor; R: ...) return Boolean; function "<" (L:...; R: Cursor) return Boolean; function ">" (L:...; R: Cursor) return Boolean; |
Key | Element | ||||
procedure Iterate(C: in T; Process: not null acc proc (P: C) ); | Y | Y | Y | Y | Y | Y |
procedure Reverse_Iterate(C: in T; Process: not null acc proc (P: C) ); | Y | Y | Y | Y | ||
generic with function "<" (Left, Right: E_T) return B is <> package Generic_Sorting is function Is_Sorted(C: T) return Boolean; procedure Sort(C: in out T); procedure Merge(Target, Source: in out T); end Generic_Sorting; |
Y | Y | ||||
generic type Key_Type (<>) is private; | Y | Y | ||||
with function Key(Element: E_T) return Key_Type; | Y | Y | ||||
with function Hash(Key: K_T) return Hash_Type; | Y | |||||
with function Equivalent_Keys (L, R: Key_Type) return Boolean; | Y | |||||
with function "<" (L, R: Key_Type) return B is <> | Y | |||||
package Generic_Keys is | Y | Y | ||||
function Equivalent_Keys(L, R: Key_Type) return B; | Y | |||||
function Key(P: C) return Key_Type; | Y | Y | ||||
function Element(C: T; Key: K_T) return Element_T; | Y | Y | ||||
procedure Replace(C: in out T; Key: Key_Type; New_Item: E_T); procedure Exclude(C: in out T; Key: Key_Type); procedure Delete(C: in out T; Key: Key_Type); |
Y | Y | ||||
function Find(C: T; Key: K_T) return Cursor; | Y | Y | ||||
function Floor(C: T; Key: K_T) return Cursor; function Ceiling(C: T; Key: K_T) return Cursor; |
Y | |||||
function Contains(C: T; Key: K_T) return Boolean; | Y | Y | ||||
procedure Update_Element_Preserving_Key (C: in out T; P: C; Process: not null acc proc (Element: in out E_T) ); | Y | Y | ||||
end Generic_Keys; | Y | Y | ||||
private ... -- not specified by the language end Ada.Containers....; | Y | Y | Y | Y | Y | Y |
2010-09-17 06:22:08
2010-10-24 00:26:59
. .