[#BloombergLP-bslh-Hash_AdlWrapper]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslh.adoc[bslh]::Hash&lowbar;AdlWrapper
:relfileprefix: ../../
:mrdocs:

Wrapper that places a hash algorithm into the `bslh` namespace for ADL&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class HASH&lowbar;ALGORITHM&gt;
class Hash&lowbar;AdlWrapper;
----

== Description

This `class` is a wrapper that is useful in the case of `HASH&lowbar;ALGORITHM` not being in the `bslh` namespace, which can be problematic for ADL lookup of `bslh&colon;&colon;hashAppend`&period; Wrapping a hash algorithm in this wrapper, which is called inline, effectively forwards the algorithm into the `bslh` namespace&period;

More detailed explanation&colon;

Normally, we define the free functions `hashAppend` in the same namespaces as the types they are hashing, so that ADL will find the function&period; In cases where this is not possible, such as `std`, we support defining a `hashAppend` overload in the `bslh` namespace instead&period; This wrapper makes sure that `bslh` is an associated namespace when it is used as the first argument to `hashAppend`, ensuring that such overloads in `bslh` added outside this component are still found via ADL&period; Without this wrapper, in the cases where the hash algorithm is neither in `bslh` nor in the namespace of the hashed type, ADL then fails to find the function&period;

This wrapper solves this problem by forcibly associating the invocation of `hashAppend`, wherever it may be, with the `bslh` namespace&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslh/Hash_AdlWrapper/result_type.adoc[`result&lowbar;type`] 
| Typedef indicating the value type returned by this algorithm&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslh/Hash_AdlWrapper/2constructor.adoc[`Hash&lowbar;AdlWrapper`]         [.small]#[constructor]#
| Default construct an instance of the hash algorithm wrapped in this wrapper&period;
| xref:BloombergLP/bslh/Hash_AdlWrapper/computeHash.adoc[`computeHash`] 
| Forward the call to the identical manipulator of `HASH&lowbar;ALGORITHM` and cast the return value to &apos;result&lowbar;type&period;
| xref:BloombergLP/bslh/Hash_AdlWrapper/operator_call-0f.adoc[`operator()`] 
| Forward the call to the identical manipulator of `HASH&lowbar;ALGORITHM`, passing on the specified `input` and `numBytes`&period;
|===



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