comp.lang.ada
 help / color / mirror / Atom feed
* How to Iterate over all elements of a hashed_map.
@ 2019-10-29 13:43 Alain De Vos
  2019-10-29 14:20 ` Alain De Vos
  2019-10-29 16:48 ` Jeffrey R. Carter
  0 siblings, 2 replies; 5+ messages in thread
From: Alain De Vos @ 2019-10-29 13:43 UTC (permalink / raw)


I want to use an "associative array" , and have some code for a "string -> string" hash,

with Ada.Containers.Hashed_Maps;
----BEGIN MYHASH
   function Equivalent_Key (Left, Right : Unbounded_String) return Boolean is
   begin
      return Left = Right;
   end Equivalent_Key;
   function Hash_Func (Key : Unbounded_String) return Ada.Containers.Hash_Type is
   begin
      return Ada.Strings.Hash (To_String (Key));
   end Hash_Func;
   package My_Hash is new Ada.Containers.Hashed_Maps (Key_Type => Unbounded_String,
       Element_Type => Unbounded_String,
       Hash => Hash_Func,
       Equivalent_Keys => Equivalent_Key);
----END MYHASH
declare
Hash : My_Hash.Map;
begin
Hash.Insert ( Key => ... , New_Item => ...)
Hash.Insert ( Key => ... , New_Item => ...)

But now I want to iterate over all elements of this Hash and print the keys and items ?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-29 21:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 13:43 How to Iterate over all elements of a hashed_map Alain De Vos
2019-10-29 14:20 ` Alain De Vos
2019-10-29 15:02   ` joakimds
2019-10-29 21:56     ` Randy Brukardt
2019-10-29 16:48 ` Jeffrey R. Carter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox