1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT LIBRARY COMPONENTS                          --
4--                                                                          --
5--    A D A . C O N T A I N E R S . B O U N D E D _ H A S H E D _ S E T S   --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 2004-2020, Free Software Foundation, Inc.         --
10--                                                                          --
11-- This specification is derived from the Ada Reference Manual for use with --
12-- GNAT. The copyright notice above, and the license provisions that follow --
13-- apply solely to the  contents of the part following the private keyword. --
14--                                                                          --
15-- GNAT is free software;  you can  redistribute it  and/or modify it under --
16-- terms of the  GNU General Public License as published  by the Free Soft- --
17-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
18-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
19-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
20-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
21--                                                                          --
22-- As a special exception under Section 7 of GPL version 3, you are granted --
23-- additional permissions described in the GCC Runtime Library Exception,   --
24-- version 3.1, as published by the Free Software Foundation.               --
25--                                                                          --
26-- You should have received a copy of the GNU General Public License and    --
27-- a copy of the GCC Runtime Library Exception along with this program;     --
28-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
29-- <http://www.gnu.org/licenses/>.                                          --
30--                                                                          --
31-- This unit was originally developed by Matthew J Heaney.                  --
32------------------------------------------------------------------------------
33
34with Ada.Iterator_Interfaces;
35
36private with Ada.Containers.Hash_Tables;
37with Ada.Containers.Helpers;
38private with Ada.Streams;
39private with Ada.Finalization;
40private with Ada.Strings.Text_Output;
41
42generic
43   type Element_Type is private;
44
45   with function Hash (Element : Element_Type) return Hash_Type;
46
47   with function Equivalent_Elements
48          (Left, Right : Element_Type) return Boolean;
49
50   with function "=" (Left, Right : Element_Type) return Boolean is <>;
51
52package Ada.Containers.Bounded_Hashed_Sets with
53  SPARK_Mode => Off
54is
55   pragma Annotate (CodePeer, Skip_Analysis);
56   pragma Pure;
57   pragma Remote_Types;
58
59   type Set (Capacity : Count_Type; Modulus : Hash_Type) is tagged private
60     with Constant_Indexing => Constant_Reference,
61          Default_Iterator  => Iterate,
62          Iterator_Element  => Element_Type,
63          Aggregate         => (Empty       => Empty,
64                                Add_Unnamed => Include);
65
66   pragma Preelaborable_Initialization (Set);
67
68   type Cursor is private;
69   pragma Preelaborable_Initialization (Cursor);
70
71   Empty_Set : constant Set;
72   --  Set objects declared without an initialization expression are
73   --  initialized to the value Empty_Set.
74
75   function Empty (Capacity : Count_Type := 10) return Set;
76
77   No_Element : constant Cursor;
78   --  Cursor objects declared without an initialization expression are
79   --  initialized to the value No_Element.
80
81   function Has_Element (Position : Cursor) return Boolean;
82   --  Equivalent to Position /= No_Element
83
84   package Set_Iterator_Interfaces is new
85     Ada.Iterator_Interfaces (Cursor, Has_Element);
86
87   function "=" (Left, Right : Set) return Boolean;
88   --  For each element in Left, set equality attempts to find the equal
89   --  element in Right; if a search fails, then set equality immediately
90   --  returns False. The search works by calling Hash to find the bucket in
91   --  the Right set that corresponds to the Left element. If the bucket is
92   --  non-empty, the search calls the generic formal element equality operator
93   --  to compare the element (in Left) to the element of each node in the
94   --  bucket (in Right); the search terminates when a matching node in the
95   --  bucket is found, or the nodes in the bucket are exhausted. (Note that
96   --  element equality is called here, not Equivalent_Elements. Set equality
97   --  is the only operation in which element equality is used. Compare set
98   --  equality to Equivalent_Sets, which does call Equivalent_Elements.)
99
100   function Equivalent_Sets (Left, Right : Set) return Boolean;
101   --  Similar to set equality, with the difference that the element in Left is
102   --  compared to the elements in Right using the generic formal
103   --  Equivalent_Elements operation instead of element equality.
104
105   function To_Set (New_Item : Element_Type) return Set;
106   --  Constructs a singleton set comprising New_Element. To_Set calls Hash to
107   --  determine the bucket for New_Item.
108
109   function Capacity (Container : Set) return Count_Type;
110   --  Returns the current capacity of the set. Capacity is the maximum length
111   --  before which rehashing in guaranteed not to occur.
112
113   procedure Reserve_Capacity (Container : in out Set; Capacity : Count_Type);
114   --  If the value of the Capacity actual parameter is less or equal to
115   --  Container.Capacity, then the operation has no effect.  Otherwise it
116   --  raises Capacity_Error (as no expansion of capacity is possible for a
117   --  bounded form).
118
119   function Default_Modulus (Capacity : Count_Type) return Hash_Type;
120   --  Returns a modulus value (hash table size) which is optimal for the
121   --  specified capacity (which corresponds to the maximum number of items).
122
123   function Length (Container : Set) return Count_Type;
124   --  Returns the number of items in the set
125
126   function Is_Empty (Container : Set) return Boolean;
127   --  Equivalent to Length (Container) = 0
128
129   procedure Clear (Container : in out Set);
130   --  Removes all of the items from the set. This will deallocate all memory
131   --  associated with this set.
132
133   function Element (Position : Cursor) return Element_Type;
134   --  Returns the element of the node designated by the cursor
135
136   procedure Replace_Element
137     (Container : in out Set;
138      Position  : Cursor;
139      New_Item  : Element_Type);
140   --  If New_Item is equivalent (as determined by calling Equivalent_Elements)
141   --  to the element of the node designated by Position, then New_Element is
142   --  assigned to that element. Otherwise, it calls Hash to determine the
143   --  bucket for New_Item. If the bucket is not empty, then it calls
144   --  Equivalent_Elements for each node in that bucket to determine whether
145   --  New_Item is equivalent to an element in that bucket. If
146   --  Equivalent_Elements returns True then Program_Error is raised (because
147   --  an element may appear only once in the set); otherwise, New_Item is
148   --  assigned to the node designated by Position, and the node is moved to
149   --  its new bucket.
150
151   procedure Query_Element
152     (Position : Cursor;
153      Process  : not null access procedure (Element : Element_Type));
154   --  Calls Process with the element (having only a constant view) of the node
155   --  designated by the cursor.
156
157   type Constant_Reference_Type
158     (Element : not null access constant Element_Type) is private
159        with Implicit_Dereference => Element;
160
161   function Constant_Reference
162     (Container : aliased Set;
163      Position  : Cursor) return Constant_Reference_Type;
164
165   procedure Assign (Target : in out Set; Source : Set);
166   --  If Target denotes the same object as Source, then the operation has no
167   --  effect. If the Target capacity is less than the Source length, then
168   --  Assign raises Capacity_Error.  Otherwise, Assign clears Target and then
169   --  copies the (active) elements from Source to Target.
170
171   function Copy
172     (Source   : Set;
173      Capacity : Count_Type := 0;
174      Modulus  : Hash_Type := 0) return Set;
175   --  Constructs a new set object whose elements correspond to Source.  If the
176   --  Capacity parameter is 0, then the capacity of the result is the same as
177   --  the length of Source. If the Capacity parameter is equal or greater than
178   --  the length of Source, then the capacity of the result is the specified
179   --  value. Otherwise, Copy raises Capacity_Error. If the Modulus parameter
180   --  is 0, then the modulus of the result is the value returned by a call to
181   --  Default_Modulus with the capacity parameter determined as above;
182   --  otherwise the modulus of the result is the specified value.
183
184   procedure Move (Target : in out Set; Source : in out Set);
185   --  Clears Target (if it's not empty), and then moves (not copies) the
186   --  buckets array and nodes from Source to Target.
187
188   procedure Insert
189     (Container : in out Set;
190      New_Item  : Element_Type;
191      Position  : out Cursor;
192      Inserted  : out Boolean);
193   --  Conditionally inserts New_Item into the set. If New_Item is already in
194   --  the set, then Inserted returns False and Position designates the node
195   --  containing the existing element (which is not modified). If New_Item is
196   --  not already in the set, then Inserted returns True and Position
197   --  designates the newly-inserted node containing New_Item. The search for
198   --  an existing element works as follows. Hash is called to determine
199   --  New_Item's bucket; if the bucket is non-empty, then Equivalent_Elements
200   --  is called to compare New_Item to the element of each node in that
201   --  bucket. If the bucket is empty, or there were no equivalent elements in
202   --  the bucket, the search "fails" and the New_Item is inserted in the set
203   --  (and Inserted returns True); otherwise, the search "succeeds" (and
204   --  Inserted returns False).
205
206   procedure Insert  (Container : in out Set; New_Item : Element_Type);
207   --  Attempts to insert New_Item into the set, performing the usual insertion
208   --  search (which involves calling both Hash and Equivalent_Elements); if
209   --  the search succeeds (New_Item is equivalent to an element already in the
210   --  set, and so was not inserted), then this operation raises
211   --  Constraint_Error. (This version of Insert is similar to Replace, but
212   --  having the opposite exception behavior. It is intended for use when you
213   --  want to assert that the item is not already in the set.)
214
215   procedure Include (Container : in out Set; New_Item : Element_Type);
216   --  Attempts to insert New_Item into the set. If an element equivalent to
217   --  New_Item is already in the set (the insertion search succeeded, and
218   --  hence New_Item was not inserted), then the value of New_Item is assigned
219   --  to the existing element. (This insertion operation only raises an
220   --  exception if cursor tampering occurs. It is intended for use when you
221   --  want to insert the item in the set, and you don't care whether an
222   --  equivalent element is already present.)
223
224   procedure Replace (Container : in out Set; New_Item : Element_Type);
225   --  Searches for New_Item in the set; if the search fails (because an
226   --  equivalent element was not in the set), then it raises
227   --  Constraint_Error. Otherwise, the existing element is assigned the value
228   --  New_Item. (This is similar to Insert, but with the opposite exception
229   --  behavior. It is intended for use when you want to assert that the item
230   --  is already in the set.)
231
232   procedure Exclude (Container : in out Set; Item : Element_Type);
233   --  Searches for Item in the set, and if found, removes its node from the
234   --  set and then deallocates it. The search works as follows. The operation
235   --  calls Hash to determine the item's bucket; if the bucket is not empty,
236   --  it calls Equivalent_Elements to compare Item to the element of each node
237   --  in the bucket. (This is the deletion analog of Include. It is intended
238   --  for use when you want to remove the item from the set, but don't care
239   --  whether the item is already in the set.)
240
241   procedure Delete  (Container : in out Set; Item : Element_Type);
242   --  Searches for Item in the set (which involves calling both Hash and
243   --  Equivalent_Elements). If the search fails, then the operation raises
244   --  Constraint_Error. Otherwise it removes the node from the set and then
245   --  deallocates it. (This is the deletion analog of non-conditional
246   --  Insert. It is intended for use when you want to assert that the item is
247   --  already in the set.)
248
249   procedure Delete (Container : in out Set; Position : in out Cursor);
250   --  Removes the node designated by Position from the set, and then
251   --  deallocates the node. The operation calls Hash to determine the bucket,
252   --  and then compares Position to each node in the bucket until there's a
253   --  match (it does not call Equivalent_Elements).
254
255   procedure Union (Target : in out Set; Source : Set);
256   --  Iterates over the Source set, and conditionally inserts each element
257   --  into Target.
258
259   function Union (Left, Right : Set) return Set;
260   --  The operation first copies the Left set to the result, and then iterates
261   --  over the Right set to conditionally insert each element into the result.
262
263   function "or" (Left, Right : Set) return Set renames Union;
264
265   procedure Intersection (Target : in out Set; Source : Set);
266   --  Iterates over the Target set (calling First and Next), calling Find to
267   --  determine whether the element is in Source. If an equivalent element is
268   --  not found in Source, the element is deleted from Target.
269
270   function Intersection (Left, Right : Set) return Set;
271   --  Iterates over the Left set, calling Find to determine whether the
272   --  element is in Right. If an equivalent element is found, it is inserted
273   --  into the result set.
274
275   function "and" (Left, Right : Set) return Set renames Intersection;
276
277   procedure Difference (Target : in out Set; Source : Set);
278   --  Iterates over the Source (calling First and Next), calling Find to
279   --  determine whether the element is in Target. If an equivalent element is
280   --  found, it is deleted from Target.
281
282   function Difference (Left, Right : Set) return Set;
283   --  Iterates over the Left set, calling Find to determine whether the
284   --  element is in the Right set. If an equivalent element is not found, the
285   --  element is inserted into the result set.
286
287   function "-" (Left, Right : Set) return Set renames Difference;
288
289   procedure Symmetric_Difference (Target : in out Set; Source : Set);
290   --  The operation iterates over the Source set, searching for the element
291   --  in Target (calling Hash and Equivalent_Elements). If an equivalent
292   --  element is found, it is removed from Target; otherwise it is inserted
293   --  into Target.
294
295   function Symmetric_Difference (Left, Right : Set) return Set;
296   --  The operation first iterates over the Left set. It calls Find to
297   --  determine whether the element is in the Right set. If no equivalent
298   --  element is found, the element from Left is inserted into the result. The
299   --  operation then iterates over the Right set, to determine whether the
300   --  element is in the Left set. If no equivalent element is found, the Right
301   --  element is inserted into the result.
302
303   function "xor" (Left, Right : Set) return Set
304     renames Symmetric_Difference;
305
306   function Overlap (Left, Right : Set) return Boolean;
307   --  Iterates over the Left set (calling First and Next), calling Find to
308   --  determine whether the element is in the Right set. If an equivalent
309   --  element is found, the operation immediately returns True. The operation
310   --  returns False if the iteration over Left terminates without finding any
311   --  equivalent element in Right.
312
313   function Is_Subset (Subset : Set; Of_Set : Set) return Boolean;
314   --  Iterates over Subset (calling First and Next), calling Find to determine
315   --  whether the element is in Of_Set. If no equivalent element is found in
316   --  Of_Set, the operation immediately returns False. The operation returns
317   --  True if the iteration over Subset terminates without finding an element
318   --  not in Of_Set (that is, every element in Subset is equivalent to an
319   --  element in Of_Set).
320
321   function First (Container : Set) return Cursor;
322   --  Returns a cursor that designates the first non-empty bucket, by
323   --  searching from the beginning of the buckets array.
324
325   function Next (Position : Cursor) return Cursor;
326   --  Returns a cursor that designates the node that follows the current one
327   --  designated by Position. If Position designates the last node in its
328   --  bucket, the operation calls Hash to compute the index of this bucket,
329   --  and searches the buckets array for the first non-empty bucket, starting
330   --  from that index; otherwise, it simply follows the link to the next node
331   --  in the same bucket.
332
333   procedure Next (Position : in out Cursor);
334   --  Equivalent to Position := Next (Position)
335
336   function Find
337     (Container : Set;
338      Item      : Element_Type) return Cursor;
339   --  Searches for Item in the set. Find calls Hash to determine the item's
340   --  bucket; if the bucket is not empty, it calls Equivalent_Elements to
341   --  compare Item to each element in the bucket. If the search succeeds, Find
342   --  returns a cursor designating the node containing the equivalent element;
343   --  otherwise, it returns No_Element.
344
345   function Contains (Container : Set; Item : Element_Type) return Boolean;
346   --  Equivalent to Find (Container, Item) /= No_Element
347
348   function Equivalent_Elements (Left, Right : Cursor) return Boolean;
349   --  Returns the result of calling Equivalent_Elements with the elements of
350   --  the nodes designated by cursors Left and Right.
351
352   function Equivalent_Elements
353     (Left  : Cursor;
354      Right : Element_Type) return Boolean;
355   --  Returns the result of calling Equivalent_Elements with element of the
356   --  node designated by Left and element Right.
357
358   function Equivalent_Elements
359     (Left  : Element_Type;
360      Right : Cursor) return Boolean;
361   --  Returns the result of calling Equivalent_Elements with element Left and
362   --  the element of the node designated by Right.
363
364   procedure Iterate
365     (Container : Set;
366      Process   : not null access procedure (Position : Cursor));
367   --  Calls Process for each node in the set
368
369   function Iterate
370     (Container : Set)
371      return Set_Iterator_Interfaces.Forward_Iterator'Class;
372
373   generic
374      type Key_Type (<>) is private;
375
376      with function Key (Element : Element_Type) return Key_Type;
377
378      with function Hash (Key : Key_Type) return Hash_Type;
379
380      with function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
381
382   package Generic_Keys is
383
384      function Key (Position : Cursor) return Key_Type;
385      --  Applies generic formal operation Key to the element of the node
386      --  designated by Position.
387
388      function Element (Container : Set; Key : Key_Type) return Element_Type;
389      --  Searches (as per the key-based Find) for the node containing Key, and
390      --  returns the associated element.
391
392      procedure Replace
393        (Container : in out Set;
394         Key       : Key_Type;
395         New_Item  : Element_Type);
396      --  Searches (as per the key-based Find) for the node containing Key, and
397      --  then replaces the element of that node (as per the element-based
398      --  Replace_Element).
399
400      procedure Exclude (Container : in out Set; Key : Key_Type);
401      --  Searches for Key in the set, and if found, removes its node from the
402      --  set and then deallocates it. The search works by first calling Hash
403      --  (on Key) to determine the bucket; if the bucket is not empty, it
404      --  calls Equivalent_Keys to compare parameter Key to the value of
405      --  generic formal operation Key applied to element of each node in the
406      --  bucket.
407
408      procedure Delete (Container : in out Set; Key : Key_Type);
409      --  Deletes the node containing Key as per Exclude, with the difference
410      --  that Constraint_Error is raised if Key is not found.
411
412      function Find (Container : Set; Key : Key_Type) return Cursor;
413      --  Searches for the node containing Key, and returns a cursor
414      --  designating the node. The search works by first calling Hash (on Key)
415      --  to determine the bucket. If the bucket is not empty, the search
416      --  compares Key to the element of each node in the bucket, and returns
417      --  the matching node. The comparison itself works by applying the
418      --  generic formal Key operation to the element of the node, and then
419      --  calling generic formal operation Equivalent_Keys.
420
421      function Contains (Container : Set; Key : Key_Type) return Boolean;
422      --  Equivalent to Find (Container, Key) /= No_Element
423
424      procedure Update_Element_Preserving_Key
425        (Container : in out Set;
426         Position  : Cursor;
427         Process   : not null access
428                       procedure (Element : in out Element_Type));
429      --  Calls Process with the element of the node designated by Position,
430      --  but with the restriction that the key-value of the element is not
431      --  modified. The operation first makes a copy of the value returned by
432      --  applying generic formal operation Key on the element of the node, and
433      --  then calls Process with the element. The operation verifies that the
434      --  key-part has not been modified by calling generic formal operation
435      --  Equivalent_Keys to compare the saved key-value to the value returned
436      --  by applying generic formal operation Key to the post-Process value of
437      --  element. If the key values compare equal then the operation
438      --  completes. Otherwise, the node is removed from the map and
439      --  Program_Error is raised.
440
441      type Reference_Type (Element : not null access Element_Type) is private
442        with Implicit_Dereference => Element;
443
444      function Reference_Preserving_Key
445        (Container : aliased in out Set;
446         Position  : Cursor) return Reference_Type;
447
448      function Constant_Reference
449        (Container : aliased Set;
450         Key       : Key_Type) return Constant_Reference_Type;
451
452      function Reference_Preserving_Key
453        (Container : aliased in out Set;
454         Key       : Key_Type) return Reference_Type;
455
456   private
457      type Set_Access is access all Set;
458      for Set_Access'Storage_Size use 0;
459
460      package Impl is new Helpers.Generic_Implementation;
461
462      type Reference_Control_Type is
463         new Impl.Reference_Control_Type with
464      record
465         Container : Set_Access;
466         Index     : Hash_Type;
467         Old_Pos   : Cursor;
468         Old_Hash  : Hash_Type;
469      end record;
470
471      overriding procedure Finalize (Control : in out Reference_Control_Type);
472      pragma Inline (Finalize);
473
474      type Reference_Type (Element : not null access Element_Type) is record
475         Control  : Reference_Control_Type;
476      end record;
477
478      use Ada.Streams;
479
480      procedure Read
481        (Stream : not null access Root_Stream_Type'Class;
482         Item   : out Reference_Type);
483
484      for Reference_Type'Read use Read;
485
486      procedure Write
487        (Stream : not null access Root_Stream_Type'Class;
488         Item   : Reference_Type);
489
490      for Reference_Type'Write use Write;
491
492   end Generic_Keys;
493
494private
495   pragma Inline (Next);
496
497   type Node_Type is record
498      Element : aliased Element_Type;
499      Next    : Count_Type;
500   end record;
501
502   package HT_Types is
503     new Hash_Tables.Generic_Bounded_Hash_Table_Types (Node_Type);
504
505   type Set (Capacity : Count_Type; Modulus : Hash_Type) is
506     new HT_Types.Hash_Table_Type (Capacity, Modulus)
507      with null record with Put_Image => Put_Image;
508
509   procedure Put_Image
510     (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set);
511
512   use HT_Types, HT_Types.Implementation;
513   use Ada.Streams;
514
515   procedure Write
516     (Stream    : not null access Root_Stream_Type'Class;
517      Container : Set);
518
519   for Set'Write use Write;
520
521   procedure Read
522     (Stream    : not null access Root_Stream_Type'Class;
523      Container : out Set);
524
525   for Set'Read use Read;
526
527   type Set_Access is access all Set;
528   for Set_Access'Storage_Size use 0;
529
530   --  Note: If a Cursor object has no explicit initialization expression,
531   --  it must default initialize to the same value as constant No_Element.
532   --  The Node component of type Cursor has scalar type Count_Type, so it
533   --  requires an explicit initialization expression of its own declaration,
534   --  in order for objects of record type Cursor to properly initialize.
535
536   type Cursor is record
537      Container : Set_Access;
538      Node      : Count_Type := 0;
539   end record;
540
541   procedure Write
542     (Stream : not null access Root_Stream_Type'Class;
543      Item   : Cursor);
544
545   for Cursor'Write use Write;
546
547   procedure Read
548     (Stream : not null access Root_Stream_Type'Class;
549      Item   : out Cursor);
550
551   for Cursor'Read use Read;
552
553   subtype Reference_Control_Type is Implementation.Reference_Control_Type;
554   --  It is necessary to rename this here, so that the compiler can find it
555
556   type Constant_Reference_Type
557     (Element : not null access constant Element_Type) is
558      record
559         Control : Reference_Control_Type :=
560           raise Program_Error with "uninitialized reference";
561         --  The RM says, "The default initialization of an object of
562         --  type Constant_Reference_Type or Reference_Type propagates
563         --  Program_Error."
564      end record;
565
566   procedure Read
567     (Stream : not null access Root_Stream_Type'Class;
568      Item   : out Constant_Reference_Type);
569
570   for Constant_Reference_Type'Read use Read;
571
572   procedure Write
573     (Stream : not null access Root_Stream_Type'Class;
574      Item   : Constant_Reference_Type);
575
576   for Constant_Reference_Type'Write use Write;
577
578   --  Three operations are used to optimize in the expansion of "for ... of"
579   --  loops: the Next(Cursor) procedure in the visible part, and the following
580   --  Pseudo_Reference and Get_Element_Access functions. See Sem_Ch5 for
581   --  details.
582
583   function Pseudo_Reference
584     (Container : aliased Set'Class) return Reference_Control_Type;
585   pragma Inline (Pseudo_Reference);
586   --  Creates an object of type Reference_Control_Type pointing to the
587   --  container, and increments the Lock. Finalization of this object will
588   --  decrement the Lock.
589
590   type Element_Access is access all Element_Type with
591     Storage_Size => 0;
592
593   function Get_Element_Access
594     (Position : Cursor) return not null Element_Access;
595   --  Returns a pointer to the element designated by Position.
596
597   Empty_Set : constant Set :=
598                 (Hash_Table_Type with Capacity => 0, Modulus => 0);
599
600   No_Element : constant Cursor := (Container => null, Node => 0);
601
602   type Iterator is new Ada.Finalization.Limited_Controlled and
603     Set_Iterator_Interfaces.Forward_Iterator with
604   record
605      Container : Set_Access;
606   end record
607     with Disable_Controlled => not T_Check;
608
609   overriding procedure Finalize (Object : in out Iterator);
610
611   overriding function First (Object : Iterator) return Cursor;
612
613   overriding function Next
614     (Object   : Iterator;
615      Position : Cursor) return Cursor;
616
617end Ada.Containers.Bounded_Hashed_Sets;
618