An adapter that forwards the HashAlgorithm::operator(data, length) function concept into a runtime-provided std::function of the same signature.
This is useful for passing a concrete HashAlgorithm implementation through into non-templated code, such as with an Impl or Cell pattern.
#include <drake/common/hash.h>
Public Types | |
using | Func = std::function< void(const void *, size_t)> |
A std::function whose signature matches HashAlgorithm::operator(). More... | |
Public Member Functions | |
DelegatingHasher (Func func) | |
Create a delegating hasher that calls the given func . More... | |
void | operator() (const void *data, size_t length) noexcept |
Append [data, data + length) bytes into the wrapped algorithm. More... | |
using Func = std::function<void(const void*, size_t)> |
A std::function whose signature matches HashAlgorithm::operator().
|
explicit |
Create a delegating hasher that calls the given func
.
|
noexcept |
Append [data, data + length) bytes into the wrapped algorithm.