# Section 8.1.2.4:
ELT_HASH

###### class ELT_HASH

#### Formal Types

types
SAME = ELT_HASH ;

This class provides a hash operation only. It is intended for use inside container classes. Each invocation on the same object is guaranteed to return the same hash value.

It should be noted that this cannot be a partial class because of the rule that a call into a partial class cannot be made from within another partial class.

#### elt_hash

This is the sole operation provided by this class. If the argument class derives from $HASH then the hash method provided in that class is used, otherwise if the arguments are immutable then an exception is raised, otherwise the implementation-defined object hashing method is used.

elt_hash | (
| item : $OB
| ) : CARD

##### Formal Signature

elt_hash(item : [$OB]) res : CARD

##### Pre-condition

The specification of the auxiliary routine typeof is given in Section 6.9.

pre typeof(item) in set $HASH
or not REFERENCE.is_immutable(item)
or (typeof(item) = nil)

##### Post-condition

The result of applying this feature is a deterministic implementation-defined value - with the sole exception that if the object does not exist (ie is nil) then zero must be returned.

This routine returns a hash value for the given item, using the hash routine defined in the class of item (if one is defined), otherwise it uses the implementation-defined hash function.

| Language Index |  | Library Index |  | Basic Index

Comments or enquiries should be made to Keith Hopper. Page last modified: Thursday, 25 May 2000. |