Mmmmh - always better to test examples before posting...
This one is working:
-----8<-----------8<-----------8<-----------8<------
with Ada.Containers.Hashed_Maps;
with Ada.Strings.Unbounded.Hash;
with Ada.Text_IO;
procedure Dummy_dico is
package Dictionaries is new Ada.Containers.Hashed_Maps
(Ada.Strings.Unbounded.Unbounded_String,
Ada.Strings.Unbounded.Unbounded_String,
Ada.Strings.Unbounded.Hash,
Ada.Strings.Unbounded."=",
Ada.Strings.Unbounded."=");
use Dictionaries;
function "-" (Source : Ada.Strings.Unbounded.Unbounded_String) return
String
renames Ada.Strings.Unbounded.To_String;
function "+" (Source : String) return
Ada.Strings.Unbounded.Unbounded_String
renames Ada.Strings.Unbounded.To_Unbounded_String;
procedure Translate( dico: Map; from: String ) is
use Ada.Text_IO;
begin
Put_Line( from & " ---> " & (-Element(dico,+from)) );
end Translate;
dico_F_to_E: Map;
c: Cursor;
s: Boolean;
begin
Insert(dico_F_to_E, +"souris", +"mouse", c, s);
Insert(dico_F_to_E, +"chat", +"cat", c, s);
Insert(dico_F_to_E, +"chien", +"dog", c, s);
Insert(dico_F_to_E, +"cheval", +"horse", c, s);
--
Translate(dico_F_to_E, "chien");
Translate(dico_F_to_E, "chat");
end;


|