21#ifndef BEAST_HASH_HASH_APPEND_H_INCLUDED
22#define BEAST_HASH_HASH_APPEND_H_INCLUDED
24#include <boost/container/flat_set.hpp>
25#include <boost/endian/conversion.hpp>
50 unsigned char* bytes =
static_cast<unsigned char*
>(
52 for (
unsigned i = 0; i <
sizeof(T) / 2; ++i)
53 std::swap(bytes[i], bytes[
sizeof(T) - 1 - i]);
71template <
class T,
class Hasher>
80 Hasher::endian != boost::endian::order::native>{});
96 std::is_integral<T>::value || std::is_enum<T>::value ||
97 std::is_pointer<T>::value>
123template <
class T,
class U>
127 is_uniquely_represented<T>::value &&
128 is_uniquely_represented<U>::value &&
129 sizeof(T) + sizeof(U) == sizeof(std::pair<T, U>)>
140 std::conjunction_v<is_uniquely_represented<T>...> &&
141 sizeof(std::tuple<T...>) == (sizeof(T) + ...)>
148template <
class T, std::
size_t N>
156template <
class T, std::
size_t N>
160 is_uniquely_represented<T>::value &&
161 sizeof(T) * N == sizeof(std::array<T, N>)>
180template <
class T,
class HashAlgorithm>
184 is_uniquely_represented<T>::value &&
186 HashAlgorithm::endian == boost::endian::order::native)>
191template <
class T, std::
size_t N,
class HashAlgorithm>
195 is_uniquely_represented<T[N]>::value &&
197 HashAlgorithm::endian == boost::endian::order::native)>
232template <
class Hasher,
class T>
239template <
class Hasher,
class T>
241 !is_contiguously_hashable<T, Hasher>::value &&
250template <
class Hasher,
class T>
260template <
class Hasher>
264 void const* p =
nullptr;
271template <
class Hasher,
class T, std::
size_t N>
275template <
class Hasher,
class CharT,
class Traits,
class Alloc>
281template <
class Hasher,
class CharT,
class Traits,
class Alloc>
287template <
class Hasher,
class T,
class U>
291template <
class Hasher,
class T,
class Alloc>
295template <
class Hasher,
class T,
class Alloc>
299template <
class Hasher,
class T, std::
size_t N>
303template <
class Hasher,
class... T>
307template <
class Hasher,
class Key,
class T,
class Hash,
class Pred,
class Alloc>
311template <
class Hasher,
class Key,
class Hash,
class Pred,
class Alloc>
315template <
class Hasher,
class Key,
class Compare,
class Alloc>
319 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept;
320template <
class Hasher,
class Key,
class Compare,
class Alloc>
324 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept;
325template <
class Hasher,
class T0,
class T1,
class... T>
327hash_append(Hasher& h, T0
const& t0, T1
const& t1, T
const&... t)
noexcept;
331template <
class Hasher,
class T, std::
size_t N>
335 for (
auto const& t : a)
341template <
class Hasher,
class CharT,
class Traits,
class Alloc>
352template <
class Hasher,
class CharT,
class Traits,
class Alloc>
358 h(s.data(), s.size() *
sizeof(CharT));
364template <
class Hasher,
class T,
class U>
366 !is_contiguously_hashable<std::pair<T, U>, Hasher>::value>
374template <
class Hasher,
class T,
class Alloc>
378 for (
auto const& t : v)
383template <
class Hasher,
class T,
class Alloc>
387 h(v.data(), v.size() *
sizeof(T));
393template <
class Hasher,
class T, std::
size_t N>
397 for (
auto const& t : a)
401template <
class Hasher,
class Key,
class Compare,
class Alloc>
405 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept
407 for (
auto const& t : v)
410template <
class Hasher,
class Key,
class Compare,
class Alloc>
414 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept
416 h(&(v.begin()), v.size() *
sizeof(Key));
427template <
class Hasher,
class T>
435template <
class Hasher,
class... T,
std::size_t... I>
447template <
class Hasher,
class... T>
449 !is_contiguously_hashable<
std::tuple<T...>, Hasher>::value>
457template <
class Hasher,
class T>
466template <
class Hasher,
class Rep,
class Period>
473template <
class Hasher,
class Clock,
class Duration>
484template <
class Hasher,
class T0,
class T1,
class... T>
486hash_append(Hasher& h, T0
const& t0, T1
const& t1, T
const&... t)
noexcept
494template <
class HashAlgorithm>
int hash_one(Hasher &h, T const &t) noexcept
void maybe_reverse_bytes(T &t, std::false_type)
void tuple_hash(Hasher &h, std::tuple< T... > const &t, std::index_sequence< I... >) noexcept
void for_each_item(...) noexcept
std::enable_if_t< is_contiguously_hashable< T, Hasher >::value > hash_append(Hasher &h, T const &t) noexcept
Logically concatenate input data to a Hasher.
is_contiguously_hashable()=default
Metafunction returning true if the type can be hashed in one call.
is_contiguously_hashable()=default
is_uniquely_represented()=default
is_uniquely_represented()=default
is_uniquely_represented()=default
is_uniquely_represented()=default
is_uniquely_represented()=default
is_uniquely_represented()=default
is_uniquely_represented()=default
is_uniquely_represented()=default