Re: is_equal of HASHABLE
José Bollo <[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.smalleiffel |
|---|---|
| Message-ID | <[email protected]> |
Le vendredi 13 Mai 2005 13:51, Frank Boehme a écrit :
> Frank Boehme wrote:
> > > Doing such thing would break codes that use SET to record objects by
> > > there address (hash_code: INTEGER is do Result :=
> > > to_pointer.hash_code). Maybe such implementation may be usefull.
>
> More about that: I think such code should only be used for hashing if
> only the "fast-.." features are used for lookup, i.e. the ones based on
> '=' rahter than 'is_equal'.
>
> F
yes indeed
i was wrong.
for the kind of need about wich i wrote, a class as above is enougth.
expanded class ?????[X]
inherit HASHABLE COMPARABLE
feature
item : X
set_item(x: like item) is do item := x end
hash_code: ITENGER is do item.to_pointer.hash_code end
infix "<"(other: like Current): BOOLEAN is do
Result := pointer_to_integer(item.to_pointer)
< pointer_to_integer(item.to_pointer) end
feature {}
pointer_to_integer(p: POINTER): INTEGER_64 is external
"C inline" alias "(int_64_t)($p)" end
end
But i can not find a name for such kind of utility class (IDENTIFICATION?,
ALIAS?, ISOLATOR?)
regards
jb