hash/simple: forward arguments to hash function

This commit is contained in:
Danny Robson 2016-11-17 18:34:16 +11:00
parent a10c091114
commit 5b44b8f3e0

View File

@ -18,20 +18,21 @@
#define __UTIL_HASH_SIMPLE_HPP #define __UTIL_HASH_SIMPLE_HPP
#include <cstdint> #include <cstdint>
#include <utility>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
namespace util { namespace hash { namespace util { namespace hash {
//template <class H, class InputT> //template <class H, class InputT>
template <class H> template <class H, typename ...Args>
typename H::digest_t typename H::digest_t
simple (const void *restrict first, const void *restrict last) noexcept simple (const void *restrict first, const void *restrict last, Args&&...args) noexcept
{ {
H h; H h (std::forward<Args> (args)...);
h.update ( h.update (
static_cast<const uint8_t*restrict> (first), static_cast<const uint8_t*restrict> (first),
static_cast<const uint8_t *restrict> (last) static_cast<const uint8_t*restrict> (last)
); );
h.finish (); h.finish ();