diff options
Diffstat (limited to 'gcc/ada/a-cbhase.adb')
-rw-r--r-- | gcc/ada/a-cbhase.adb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/ada/a-cbhase.adb b/gcc/ada/a-cbhase.adb index 97a765a..1de29ab 100644 --- a/gcc/ada/a-cbhase.adb +++ b/gcc/ada/a-cbhase.adb @@ -41,7 +41,6 @@ package body Ada.Containers.Bounded_Hashed_Sets is type Iterator is new Set_Iterator_Interfaces.Forward_Iterator with record Container : Set_Access; - Position : Cursor; end record; overriding function First (Object : Iterator) return Cursor; @@ -596,10 +595,8 @@ package body Ada.Containers.Bounded_Hashed_Sets is end First; overriding function First (Object : Iterator) return Cursor is - Node : constant Count_Type := HT_Ops.First (Object.Container.all); begin - return (if Node = 0 then No_Element - else Cursor'(Object.Container, Node)); + return Object.Container.First; end First; ----------------- @@ -911,7 +908,7 @@ package body Ada.Containers.Bounded_Hashed_Sets is function Iterate (Container : Set) return Set_Iterator_Interfaces.Forward_Iterator'Class is begin - return Iterator'(Container'Unrestricted_Access, First (Container)); + return Iterator'(Container => Container'Unrestricted_Access); end Iterate; ------------ @@ -982,12 +979,16 @@ package body Ada.Containers.Bounded_Hashed_Sets is 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 designates wrong set"; + "Position cursor of Next designates wrong set"; end if; - return (if Position.Node = 0 then No_Element else Next (Position)); + return Next (Position); end Next; ------------- @@ -1599,7 +1600,7 @@ package body Ada.Containers.Bounded_Hashed_Sets is begin if Node = 0 then - raise Constraint_Error with "key not in map"; + raise Constraint_Error with "key not in map"; -- ??? "set" end if; return Container.Nodes (Node).Element; |