[#BloombergLP-bslh-Hash-07] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslh.adoc[bslh]::Hash :relfileprefix: ../../ :mrdocs: This struct wraps the (template parameter) type `HASH_ALGORITHM` in an interface that satisfies the `hash` requirements of the C++11 standard. == Synopsis Declared in `<bslh_hash.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class HASH_ALGORITHM = xref:BloombergLP/bslh/DefaultHashAlgorithm.adoc[bslh::DefaultHashAlgorithm]> struct Hash; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslh/Hash-07/HashAlgorithm.adoc[`HashAlgorithm`] | Make the `HASH_ALGORITHM` template parameter available to clients. | xref:BloombergLP/bslh/Hash-07/result_type.adoc[`result_type`] | The type of the hash value that will be returned by the function‐call operator. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslh/Hash-07/operator_call.adoc[`operator()`] | Returns a hash value generated by the (template parameter) type `HASH_ALGORITHM` for the specified `type`. The value returned by the `HASH_ALGORITHM` is cast to `size_t` before returning. |=== == Specializations [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslh/Hash-02.adoc[`Hash<>`] | This struct wraps the (template parameter) type `HASH_ALGORITHM` in an interface that satisfies the `hash` requirements of the C++11 standard. | xref:BloombergLP/bslh/Hash-0a.adoc[`Hash<std::filesystem::path>`] | Specialization of `hash` for `std::filesystem::path` values. |=== == Derived Classes [cols="1,4"] |=== | Name| Description | xref:bsl/hash-017.adoc[`hash<basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>>`] | Specialize `bsl::hash` for strings, including an overload for pointers to allow character arrays to be hashed without converting them first. | xref:bsl/hash-06.adoc[`hash`] | Empty base class for hashing. This class, and all explicit and partial specializations of this class, shall conform to the C++11 Hash Requirements (C++11 17.6.3.4, [hash.requirements]). Unless this template is explicitly specialized, it will use the default hash algorithm provided by `bslh::Hash<>` to supply hash values. In order to hash a user‐defined type using `bsl::hash`, `bsl::hash` must be explicitly specialized for the type, or, preferably, `hashAppend` must be implemented for the type. For more details on `hashAppend` and `bslh::Hash` see the component `bslh_hash`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#