[#BloombergLP-bslalg-HashTableImpUtil-isWellFormed] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/HashTableImpUtil.adoc[HashTableImpUtil]::isWellFormed :relfileprefix: ../../../ :mrdocs: Return whether the specified hash‐table `anchor` is well‐formed. == Synopsis Declared in `<bslalg_hashtableimputil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY_CONFIG, class HASHER> static bool isWellFormed( xref:BloombergLP/bslalg/HashTableAnchor.adoc[HashTableAnchor] const& anchor, HASHER const& hasher, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator = 0); ---- == Description Return `true` if the specified `anchor` is well‐formed for the specified `hasher`. Use the specified `allocator` for temporary memory, or the default allocator if none is specified. For a `HashTableAnchor` to be considered well‐formed for a particular key policy, `KEY_CONFIG`, and hash functor, `hasher`, all of the following must be true: 1. The `anchor.listRootAddress()` is the address of a well‐formed doubly linked list (see `bslalg_bidirectionallinklistutil`). 2. Links in the doubly linked list having the same adjusted hash value are contiguous, where the adjusted hash value is the value returned by `computeBucketIndex`, for `extractKey<KEY_CONFIG>(link)` and `anchor.bucketArraySize()`. 3. Links in the doubly linked list having the same hash value are contiguous. 4. The first and last links in each bucket (in the bucket array, anchor.bucketArrayAddress()') refer to a the first and last element in the well‐formed doubly linked list of all nodes in the list having an adjusted hash value equal to that bucket's array index. If no values in the doubly linked list have an adjusted hash value equal to a bucket's index, then the addresses of the first and last links for that bucket are 0. == Return Value `true` if `anchor` is well‐formed for `hasher` == Parameters [cols="1,4"] |=== | Name| Description | *anchor* | hash table whose structure to validate | *hasher* | hash functor used to compute element hash codes | *allocator* | allocator for temporary memory, or 0 for the default |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#