summaryrefslogtreecommitdiff
path: root/gcc/ada/a-cohase.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-cohase.adb')
-rw-r--r--gcc/ada/a-cohase.adb42
1 files changed, 41 insertions, 1 deletions
diff --git a/gcc/ada/a-cohase.adb b/gcc/ada/a-cohase.adb
index e0b2345234b..fadff195ff5 100644
--- a/gcc/ada/a-cohase.adb
+++ b/gcc/ada/a-cohase.adb
@@ -41,6 +41,17 @@ with System; use type System.Address;
package body Ada.Containers.Hashed_Sets is
+ type Iterator is limited new
+ Set_Iterator_Interfaces.Forward_Iterator with record
+ Container : Set_Access;
+ end record;
+
+ overriding function First (Object : Iterator) return Cursor;
+
+ overriding function Next
+ (Object : Iterator;
+ Position : Cursor) return Cursor;
+
-----------------------
-- Local Subprograms --
-----------------------
@@ -601,6 +612,11 @@ package body Ada.Containers.Hashed_Sets is
return Cursor'(Container'Unrestricted_Access, Node);
end First;
+ function First (Object : Iterator) return Cursor is
+ begin
+ return Object.Container.First;
+ end First;
+
----------
-- Free --
----------
@@ -920,6 +936,13 @@ package body Ada.Containers.Hashed_Sets is
B := B - 1;
end Iterate;
+ function Iterate
+ (Container : Set) return Set_Iterator_Interfaces.Forward_Iterator'Class
+ is
+ begin
+ return Iterator'(Container => Container'Unrestricted_Access);
+ end Iterate;
+
------------
-- Length --
------------
@@ -973,6 +996,23 @@ package body Ada.Containers.Hashed_Sets is
Position := Next (Position);
end Next;
+ function Next
+ (Object : Iterator;
+ Position : Cursor) return Cursor
+ is
+ begin
+ if Position.Container = null then
+ return No_Element;
+ end if;
+
+ if Position.Container /= Object.Container then
+ raise Program_Error with
+ "Position cursor of Next designates wrong set";
+ end if;
+
+ return Next (Position);
+ end Next;
+
-------------
-- Overlap --
-------------
@@ -1695,7 +1735,7 @@ package body Ada.Containers.Hashed_Sets is
begin
if Node = null then
- raise Constraint_Error with "key not in map";
+ raise Constraint_Error with "key not in map"; -- ??? "set"
end if;
return Node.Element;