summaryrefslogtreecommitdiff
path: root/gcc/ada/a-coorse.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-coorse.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-coorse.adb')
-rw-r--r--gcc/ada/a-coorse.adb72
1 files changed, 44 insertions, 28 deletions
diff --git a/gcc/ada/a-coorse.adb b/gcc/ada/a-coorse.adb
index 7465f930b1f..d52ed67c9a0 100644
--- a/gcc/ada/a-coorse.adb
+++ b/gcc/ada/a-coorse.adb
@@ -860,6 +860,50 @@ package body Ada.Containers.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'Access);
+ 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'Access);
+ 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;
-----------------
@@ -1412,14 +1456,6 @@ package body Ada.Containers.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
@@ -1442,18 +1478,6 @@ package body Ada.Containers.Ordered_Sets is
return (Element => Position.Node.Element'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'Access);
- end Reference;
-
-------------
-- Replace --
-------------
@@ -1771,14 +1795,6 @@ package body Ada.Containers.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