[#bsl-hash-06]
= xref:bsl.adoc[bsl]::hash
:relfileprefix: ../
:mrdocs:

Empty base class for hashing&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;hash&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
struct hash
    : xref:BloombergLP/bslh/Hash-07.adoc[BloombergLP::bslh::Hash&lt;&gt;]
----

== Description

This class, and all explicit and partial specializations of this class, shall conform to the C&plus;&plus;11 Hash Requirements (C&plus;&plus;11 17&period;6&period;3&period;4, &lsqb;hash&period;requirements&rsqb;)&period; Unless this template is explicitly specialized, it will use the default hash algorithm provided by `bslh&colon;&colon;Hash&lt;&gt;` to supply hash values&period; In order to hash a user&hyphen;defined type using `bsl&colon;&colon;hash`, `bsl&colon;&colon;hash` must be explicitly specialized for the type, or, preferably, `hashAppend` must be implemented for the type&period; For more details on `hashAppend` and `bslh&colon;&colon;Hash` see the component `bslh&lowbar;hash`&period;

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bslh/Hash-07.adoc[BloombergLP::bslh::Hash&lt;&gt;]`
| This struct wraps the (template parameter) type `HASH&lowbar;ALGORITHM` in an interface that satisfies the `hash` requirements of the C&plus;&plus;11 standard&period;
|===

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:bsl/hash-06/HashAlgorithm.adoc[`HashAlgorithm`] 
| Make the `HASH&lowbar;ALGORITHM` template parameter available to clients&period;
| xref:bsl/hash-06/result_type.adoc[`result&lowbar;type`] 
| The type of the hash value that will be returned by the function&hyphen;call operator&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/hash-06/operator_call-0a.adoc[`operator()`] 
| Function call operators
|===


== Specializations

[cols="1,4"]
|===
| Name| Description
| xref:bsl/hash-0f5.adoc[`hash&lt;bool&gt;`] 
| Specialization of `hash` for `bool` values&period;
| xref:bsl/hash-0c5.adoc[`hash&lt;char&gt;`] 
| Specialization of `hash` for `char` values&period;
| xref:bsl/hash-09.adoc[`hash&lt;std::thread::id&gt;`] 
| Specialization of `hash` for `std&colon;&colon;thread&colon;&colon;id` values&period;
| xref:bsl/hash-0cb.adoc[`hash&lt;int&gt;`] 
| Specialization of `hash` for `int` values&period;
| xref:bsl/hash-0df.adoc[`hash&lt;long&gt;`] 
| Specialization of `hash` for `long` values&period;
| xref:bsl/hash-0d8.adoc[`hash&lt;long long&gt;`] 
| Specialization of `hash` for `long long` values&period;
| xref:bsl/hash-01b.adoc[`hash&lt;short&gt;`] 
| Specialization of `hash` for `short` values&period;
| xref:bsl/hash-047.adoc[`hash&lt;signed char&gt;`] 
| Specialization of `hash` for `signed` `char` values&period;
| xref:bsl/hash-0fb.adoc[`hash&lt;unsigned char&gt;`] 
| Specialization of `hash` for `unsigned` `char` values&period;
| xref:bsl/hash-08.adoc[`hash&lt;unsigned int&gt;`] 
| Specialization of `hash` for `unsigned` `int` values&period;
| xref:bsl/hash-0c0.adoc[`hash&lt;unsigned long&gt;`] 
| Specialization of `hash` for `unsigned` `long` values&period;
| xref:bsl/hash-02.adoc[`hash&lt;unsigned long long&gt;`] 
| Specialization of `hash` for `unsigned` `long long` values&period;
| xref:bsl/hash-0db.adoc[`hash&lt;unsigned short&gt;`] 
| Specialization of `hash` for `unsigned` `short` values&period;
| xref:bsl/hash-041.adoc[`hash&lt;wchar&lowbar;t&gt;`] 
| Specialization of `hash` for `wchar&lowbar;t` values&period;
| xref:bsl/hash-0b.adoc[`hash&lt;BSLSTL&lowbar;KEY const&gt;`] 
| This class provides hashing functionality for constant key types, by delegating to the same function for non&hyphen;constant key types&period;
| xref:bsl/hash-017.adoc[`hash&lt;basic&lowbar;string&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS, ALLOCATOR&gt;&gt;`] 
| Specialize `bsl&colon;&colon;hash` for strings, including an overload for pointers to allow character arrays to be hashed without converting them first&period;
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:bsl/hash-0b.adoc[`hash&lt;BSLSTL&lowbar;KEY const&gt;`] 
| This class provides hashing functionality for constant key types, by delegating to the same function for non&hyphen;constant key types&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
