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>
52 unsigned char* bytes =
static_cast<unsigned char*
>(
54 for (
unsigned i = 0; i <
sizeof(T) / 2; ++i)
55 std::swap(bytes[i], bytes[
sizeof(T) - 1 - i]);
73template <
class T,
class Hasher>
82 Hasher::endian != boost::endian::order::native>{});
98 std::is_integral<T>::value || std::is_enum<T>::value ||
99 std::is_pointer<T>::value>
125template <
class T,
class U>
129 is_uniquely_represented<T>::value &&
130 is_uniquely_represented<U>::value &&
131 sizeof(T) + sizeof(U) == sizeof(std::pair<T, U>)>
142 std::conjunction_v<is_uniquely_represented<T>...> &&
143 sizeof(std::tuple<T...>) == (sizeof(T) + ...)>
150template <
class T, std::
size_t N>
158template <
class T, std::
size_t N>
162 is_uniquely_represented<T>::value &&
163 sizeof(T) * N == sizeof(std::array<T, N>)>
182template <
class T,
class HashAlgorithm>
186 is_uniquely_represented<T>::value &&
188 HashAlgorithm::endian == boost::endian::order::native)>
193template <
class T, std::
size_t N,
class HashAlgorithm>
197 is_uniquely_represented<T[N]>::value &&
199 HashAlgorithm::endian == boost::endian::order::native)>
234template <
class Hasher,
class T>
241template <
class Hasher,
class T>
243 !is_contiguously_hashable<T, Hasher>::value &&
252template <
class Hasher,
class T>
262template <
class Hasher>
266 void const* p =
nullptr;
273template <
class Hasher,
class T, std::
size_t N>
277template <
class Hasher,
class CharT,
class Traits,
class Alloc>
283template <
class Hasher,
class CharT,
class Traits,
class Alloc>
289template <
class Hasher,
class T,
class U>
293template <
class Hasher,
class T,
class Alloc>
297template <
class Hasher,
class T,
class Alloc>
301template <
class Hasher,
class T, std::
size_t N>
305template <
class Hasher,
class... T>
309template <
class Hasher,
class Key,
class T,
class Hash,
class Pred,
class Alloc>
313template <
class Hasher,
class Key,
class Hash,
class Pred,
class Alloc>
317template <
class Hasher,
class Key,
class Compare,
class Alloc>
321 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept;
322template <
class Hasher,
class Key,
class Compare,
class Alloc>
326 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept;
327template <
class Hasher,
class T0,
class T1,
class... T>
329hash_append(Hasher& h, T0
const& t0, T1
const& t1, T
const&... t)
noexcept;
333template <
class Hasher,
class T, std::
size_t N>
337 for (
auto const& t : a)
343template <
class Hasher,
class CharT,
class Traits,
class Alloc>
354template <
class Hasher,
class CharT,
class Traits,
class Alloc>
360 h(s.data(), s.size() *
sizeof(CharT));
366template <
class Hasher,
class T,
class U>
368 !is_contiguously_hashable<std::pair<T, U>, Hasher>::value>
376template <
class Hasher,
class T,
class Alloc>
380 for (
auto const& t : v)
385template <
class Hasher,
class T,
class Alloc>
389 h(v.data(), v.size() *
sizeof(T));
395template <
class Hasher,
class T, std::
size_t N>
399 for (
auto const& t : a)
403template <
class Hasher,
class Key,
class Compare,
class Alloc>
407 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept
409 for (
auto const& t : v)
412template <
class Hasher,
class Key,
class Compare,
class Alloc>
416 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept
418 h(&(v.begin()), v.size() *
sizeof(Key));
429template <
class Hasher,
class T>
437template <
class Hasher,
class... T,
std::size_t... I>
449template <
class Hasher,
class... T>
451 !is_contiguously_hashable<
std::tuple<T...>, Hasher>::value>
459template <
class Hasher,
class T>
468template <
class Hasher,
class Rep,
class Period>
475template <
class Hasher,
class Clock,
class Duration>
486template <
class Hasher,
class T0,
class T1,
class... T>
488hash_append(Hasher& h, T0
const& t0, T1
const& t1, T
const&... t)
noexcept
496template <
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