summaryrefslogtreecommitdiff
path: root/gcc/ada/a-ciorse.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-27 10:11:01 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-27 10:11:01 +0000
commit7f7bd971c4e7da64838f25a1a1aced592fd5c471 (patch)
treec7ec0579749b721790ac4965474b2502ccf80d84 /gcc/ada/a-ciorse.adb
parentca70dcca983ba4626baa6adc39db954e7ad62556 (diff)
downloadgcc-7f7bd971c4e7da64838f25a1a1aced592fd5c471.tar.gz
2011-09-27 Ed Schonberg <schonberg@adacore.com>
* a-cbhase.adb, a-cbhase.ads, a-cborse.adb, a-cborse.ads, a-cihase.adb, a-cihase.ads, a-ciorse.adb, a-ciorse.ads, a-coorse.adb, a-coorse.ads: Add iterator machinery to bounded sets and indefinite sets. * a-coorma.ads: Minor reformmating. * einfo.ads: Improve the comment describing the Directly_Designated_Type function. * a-ciorma.adb, a-ciorma.ads: Add iterator machinery to indefinite ordered maps. * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Update dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179260 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-ciorse.adb')
-rw-r--r--gcc/ada/a-ciorse.adb72
1 files changed, 44 insertions, 28 deletions
diff --git a/gcc/ada/a-ciorse.adb b/gcc/ada/a-ciorse.adb
index 673cd510a3c..a330ed8b6c5 100644
--- a/gcc/ada/a-ciorse.adb
+++ b/gcc/ada/a-ciorse.adb
@@ -926,6 +926,50 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
raise Program_Error with "key was modified";
end Update_Element_Preserving_Key;
+ function Reference_Preserving_Key
+ (Container : aliased in out Set;
+ Key : Key_Type) return Constant_Reference_Type
+ is
+ Position : constant Cursor := Find (Container, Key);
+
+ begin
+ if Position.Container = null then
+ raise Constraint_Error with "Position cursor has no element";
+ end if;
+
+ return (Element => Position.Node.Element);
+ end Reference_Preserving_Key;
+
+ function Reference_Preserving_Key
+ (Container : aliased in out Set;
+ Key : Key_Type) return Reference_Type
+ is
+ Position : constant Cursor := Find (Container, Key);
+
+ begin
+ if Position.Container = null then
+ raise Constraint_Error with "Position cursor has no element";
+ end if;
+
+ return (Element => Position.Node.Element);
+ end Reference_Preserving_Key;
+
+ procedure Read
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : out Reference_Type)
+ is
+ begin
+ raise Program_Error with "attempt to stream reference";
+ end Read;
+
+ procedure Write
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : Reference_Type)
+ is
+ begin
+ raise Program_Error with "attempt to stream reference";
+ end Write;
+
end Generic_Keys;
-----------------
@@ -1500,14 +1544,6 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
procedure Read
(Stream : not null access Root_Stream_Type'Class;
- Item : out Reference_Type)
- is
- begin
- raise Program_Error with "attempt to stream reference";
- end Read;
-
- procedure Read
- (Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
is
begin
@@ -1530,18 +1566,6 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
return (Element => Position.Node.Element.all'Access);
end Constant_Reference;
- function Reference (Container : Set; Position : Cursor)
- return Reference_Type
- is
- pragma Unreferenced (Container);
- begin
- if Position.Container = null then
- raise Constraint_Error with "Position cursor has no element";
- end if;
-
- return (Element => Position.Node.Element.all'Access);
- end Reference;
-
-------------
-- Replace --
-------------
@@ -1876,14 +1900,6 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
procedure Write
(Stream : not null access Root_Stream_Type'Class;
- Item : Reference_Type)
- is
- begin
- raise Program_Error with "attempt to stream reference";
- end Write;
-
- procedure Write
- (Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type)
is
begin