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>
53 unsigned char* bytes =
static_cast<unsigned char*
>(
55 for (
unsigned i = 0; i <
sizeof(T) / 2; ++i)
56 std::swap(bytes[i], bytes[
sizeof(T) - 1 - i]);
74template <
class T,
class Hasher>
83 Hasher::endian != boost::endian::order::native>{});
99 std::is_integral<T>::value || std::is_enum<T>::value ||
100 std::is_pointer<T>::value>
126template <
class T,
class U>
130 is_uniquely_represented<T>::value &&
131 is_uniquely_represented<U>::value &&
132 sizeof(T) + sizeof(U) == sizeof(std::pair<T, U>)>
143 std::conjunction_v<is_uniquely_represented<T>...> &&
144 sizeof(std::tuple<T...>) == (sizeof(T) + ...)>
151template <
class T, std::
size_t N>
159template <
class T, std::
size_t N>
163 is_uniquely_represented<T>::value &&
164 sizeof(T) * N == sizeof(std::array<T, N>)>
183template <
class T,
class HashAlgorithm>
187 is_uniquely_represented<T>::value &&
189 HashAlgorithm::endian == boost::endian::order::native)>
194template <
class T, std::
size_t N,
class HashAlgorithm>
198 is_uniquely_represented<T[N]>::value &&
200 HashAlgorithm::endian == boost::endian::order::native)>
235template <
class Hasher,
class T>
242template <
class Hasher,
class T>
244 !is_contiguously_hashable<T, Hasher>::value &&
253template <
class Hasher,
class T>
263template <
class Hasher>
267 void const* p =
nullptr;
274template <
class Hasher,
class T, std::
size_t N>
278template <
class Hasher,
class CharT,
class Traits,
class Alloc>
284template <
class Hasher,
class CharT,
class Traits,
class Alloc>
290template <
class Hasher,
class T,
class U>
294template <
class Hasher,
class T,
class Alloc>
298template <
class Hasher,
class T,
class Alloc>
302template <
class Hasher,
class T, std::
size_t N>
306template <
class Hasher,
class... T>
310template <
class Hasher,
class Key,
class T,
class Hash,
class Pred,
class Alloc>
314template <
class Hasher,
class Key,
class Hash,
class Pred,
class Alloc>
318template <
class Hasher,
class Key,
class Compare,
class Alloc>
322 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept;
323template <
class Hasher,
class Key,
class Compare,
class Alloc>
327 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept;
328template <
class Hasher,
class T0,
class T1,
class... T>
330hash_append(Hasher& h, T0
const& t0, T1
const& t1, T
const&... t)
noexcept;
334template <
class Hasher,
class T, std::
size_t N>
338 for (
auto const& t : a)
344template <
class Hasher,
class CharT,
class Traits,
class Alloc>
355template <
class Hasher,
class CharT,
class Traits,
class Alloc>
361 h(s.data(), s.size() *
sizeof(CharT));
367template <
class Hasher,
class T,
class U>
369 !is_contiguously_hashable<std::pair<T, U>, Hasher>::value>
377template <
class Hasher,
class T,
class Alloc>
381 for (
auto const& t : v)
386template <
class Hasher,
class T,
class Alloc>
390 h(v.data(), v.size() *
sizeof(T));
396template <
class Hasher,
class T, std::
size_t N>
400 for (
auto const& t : a)
404template <
class Hasher,
class Key,
class Compare,
class Alloc>
408 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept
410 for (
auto const& t : v)
413template <
class Hasher,
class Key,
class Compare,
class Alloc>
417 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept
419 h(&(v.begin()), v.size() *
sizeof(Key));
430template <
class Hasher,
class T>
438template <
class Hasher,
class... T,
std::size_t... I>
450template <
class Hasher,
class... T>
452 !is_contiguously_hashable<
std::tuple<T...>, Hasher>::value>
460template <
class Hasher,
class T>
469template <
class Hasher,
class Rep,
class Period>
476template <
class Hasher,
class Clock,
class Duration>
487template <
class Hasher,
class T0,
class T1,
class... T>
489hash_append(Hasher& h, T0
const& t0, T1
const& t1, T
const&... t)
noexcept
497template <
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