The buckets are currently simple lists, but if the hashing algorithm is well
chosen, then that's not a major problem. This makes lookups a lot faster
than a linear search, but no particular performance guarantees are made at
The buckets are currently simple lists, but if the hashing algorithm is well
chosen, then that's not a major problem. This makes lookups a lot faster
than a linear search, but no particular performance guarantees are made at
//!< simplified form of above find() method.
contents *acquire(const key_type &key);
//!< retrieves the contents held for "key" out of the table.
/*!< afterwards, the contents pointer is the caller's responsibility; it
is no longer in the table and must be destroyed externally. if no item
//!< simplified form of above find() method.
contents *acquire(const key_type &key);
//!< retrieves the contents held for "key" out of the table.
/*!< afterwards, the contents pointer is the caller's responsibility; it
is no longer in the table and must be destroyed externally. if no item
- bucket() : basis::array<hash_wrapper<key_type, contents> >(0, NIL,
+ bucket() : basis::array<hash_wrapper<key_type, contents> >(0, NULL_POINTER,
// get a hash value.
basis::un_int hashed = _hasher->hash((const void *)&key, sizeof(key));
// make the value appropriate for our table.
// get a hash value.
basis::un_int hashed = _hasher->hash((const void *)&key, sizeof(key));
// make the value appropriate for our table.
hashed = hashed % _table->elements();
// see if the key exists in the bucket.
bucket<key_type, contents> *buck = _table->borrow(hashed);
hashed = hashed % _table->elements();
// see if the key exists in the bucket.
bucket<key_type, contents> *buck = _table->borrow(hashed);
contents *to_return = (*buck)[indy]._data;
basis::WHACK((*buck)[indy]._id); // clean the id.
buck->zap(indy, indy); // toss the storage blob for the item.
contents *to_return = (*buck)[indy]._data;
basis::WHACK((*buck)[indy]._id); // clean the id.
buck->zap(indy, indy); // toss the storage blob for the item.