aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-cohase.ads
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-11-23 14:32:44 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2011-11-23 14:32:44 +0100
commitb38c20a636ec4e92cdabecbfa487b742829ebe93 (patch)
treee4cb2a009b5464c65617b77964d5b5b7ae9ba450 /gcc/ada/a-cohase.ads
parent24fee494c559f58afeb921b96a755be8d952b1d3 (diff)
downloadgcc-b38c20a636ec4e92cdabecbfa487b742829ebe93.zip
gcc-b38c20a636ec4e92cdabecbfa487b742829ebe93.tar.gz
gcc-b38c20a636ec4e92cdabecbfa487b742829ebe93.tar.bz2
[multiple changes]
2011-11-23 Matthew Heaney <heaney@adacore.com> * a-coorse.ads, a-ciorse.ads, a-cborse.ads (Set_Iterator_Interfaces): Renamed from Ordered_Set_Iterator_Interfaces. * a-coorse.adb, a-ciorse.adb, a-cborse.adb (Iterator): Declared Iterator type as limited (First, Last): Cursor return value depends on iterator node value (Iterate): Use start position as iterator node value (Next, Previous): Forward to corresponding cursor-based operation. * a-cohase.ads, a-cohase.adb: Implemented forward iterator. * a-cihase.adb, a-cbhase.adb (Iterator): Removed unnecessary node component (First, Next): Forward call to corresponding cursor-based operation (Iterate): Representation of iterator no longer has node component 2011-11-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_intr.adb (Expand_Unc_Deallocation): Ensure that the dereference has a proper type before the side effect removal mechanism kicks in. * sem_ch3.adb (Analyze_Subtype_Declaration): Handle a rare case where the base type of the subtype is a private itype created to act as the partial view of a constrained record type. This scenario manifests with equivalent class-wide types for records with unknown discriminants. 2011-11-23 Jerome Guitton <guitton@adacore.com> * s-osprim-vxworks.adb (Clock): Use Clock_RT_Ada. 2011-11-23 Thomas Quinot <quinot@adacore.com> * s-oscons-tmplt.c: Fix unbalanced preprocessor directives Minor reformatting/reorganization. From-SVN: r181666
Diffstat (limited to 'gcc/ada/a-cohase.ads')
-rw-r--r--gcc/ada/a-cohase.ads19
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/ada/a-cohase.ads b/gcc/ada/a-cohase.ads
index 0bb370b..96944cd 100644
--- a/gcc/ada/a-cohase.ads
+++ b/gcc/ada/a-cohase.ads
@@ -34,6 +34,7 @@
private with Ada.Containers.Hash_Tables;
private with Ada.Streams;
private with Ada.Finalization;
+with Ada.Iterator_Interfaces;
generic
type Element_Type is private;
@@ -49,7 +50,11 @@ package Ada.Containers.Hashed_Sets is
pragma Preelaborate;
pragma Remote_Types;
- type Set is tagged private;
+ type Set is tagged private
+ with
+ Default_Iterator => Iterate,
+ Iterator_Element => Element_Type;
+
pragma Preelaborable_Initialization (Set);
type Cursor is private;
@@ -63,6 +68,12 @@ package Ada.Containers.Hashed_Sets is
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
+ function Has_Element (Position : Cursor) return Boolean;
+ -- Equivalent to Position /= No_Element
+
+ package Set_Iterator_Interfaces is new
+ Ada.Iterator_Interfaces (Cursor, Has_Element);
+
function "=" (Left, Right : Set) return Boolean;
-- For each element in Left, set equality attempts to find the equal
-- element in Right; if a search fails, then set equality immediately
@@ -303,9 +314,6 @@ package Ada.Containers.Hashed_Sets is
function Contains (Container : Set; Item : Element_Type) return Boolean;
-- Equivalent to Find (Container, Item) /= No_Element
- function Has_Element (Position : Cursor) return Boolean;
- -- Equivalent to Position /= No_Element
-
function Equivalent_Elements (Left, Right : Cursor) return Boolean;
-- Returns the result of calling Equivalent_Elements with the elements of
-- the nodes designated by cursors Left and Right.
@@ -327,6 +335,9 @@ package Ada.Containers.Hashed_Sets is
Process : not null access procedure (Position : Cursor));
-- Calls Process for each node in the set
+ function Iterate
+ (Container : Set) return Set_Iterator_Interfaces.Forward_Iterator'Class;
+
generic
type Key_Type (<>) is private;