93
type Data_Type (Word_Length : Positive) is record
Word : String (1 .. Word_Length); -- key-part
Count : Natural; -- payload
end record;
function Hash (Data : Data_Type) return Hash_Type is
begin
return Ada.Strings.Hash (Data.Word); -- hash of key-part
end;
function Equivalent (L, R : Data_Type) return Boolean is
begin
return L.Word = R.Word; -- compare just key-parts
end;
package Data_Sets is new Ada.Containers.Indefinite_Hashed_Sets
(Data_Type,
Hash,
Equivalent); -- ex. of why ET."=" isn't good enough