1#ifndef BEAST_HASH_HASH_APPEND_H_INCLUDED
2#define BEAST_HASH_HASH_APPEND_H_INCLUDED
4#include <boost/container/flat_set.hpp>
5#include <boost/endian/conversion.hpp>
30 unsigned char* bytes =
static_cast<unsigned char*
>(
32 for (
unsigned i = 0; i <
sizeof(T) / 2; ++i)
33 std::swap(bytes[i], bytes[
sizeof(T) - 1 - i]);
51template <
class T,
class Hasher>
60 Hasher::endian != boost::endian::order::native>{});
76 std::is_integral<T>::value || std::is_enum<T>::value ||
77 std::is_pointer<T>::value>
103template <
class T,
class U>
107 is_uniquely_represented<T>::value &&
108 is_uniquely_represented<U>::value &&
109 sizeof(T) + sizeof(U) == sizeof(std::pair<T, U>)>
120 std::conjunction_v<is_uniquely_represented<T>...> &&
121 sizeof(std::tuple<T...>) == (sizeof(T) + ...)>
128template <
class T, std::
size_t N>
136template <
class T, std::
size_t N>
140 is_uniquely_represented<T>::value &&
141 sizeof(T) * N == sizeof(std::array<T, N>)>
160template <
class T,
class HashAlgorithm>
164 is_uniquely_represented<T>::value &&
166 HashAlgorithm::endian == boost::endian::order::native)>
171template <
class T, std::
size_t N,
class HashAlgorithm>
175 is_uniquely_represented<T[N]>::value &&
177 HashAlgorithm::endian == boost::endian::order::native)>
212template <
class Hasher,
class T>
219template <
class Hasher,
class T>
221 !is_contiguously_hashable<T, Hasher>::value &&
230template <
class Hasher,
class T>
240template <
class Hasher>
244 void const* p =
nullptr;
251template <
class Hasher,
class T, std::
size_t N>
255template <
class Hasher,
class CharT,
class Traits,
class Alloc>
261template <
class Hasher,
class CharT,
class Traits,
class Alloc>
267template <
class Hasher,
class T,
class U>
271template <
class Hasher,
class T,
class Alloc>
275template <
class Hasher,
class T,
class Alloc>
279template <
class Hasher,
class T, std::
size_t N>
283template <
class Hasher,
class... T>
287template <
class Hasher,
class Key,
class T,
class Hash,
class Pred,
class Alloc>
291template <
class Hasher,
class Key,
class Hash,
class Pred,
class Alloc>
295template <
class Hasher,
class Key,
class Compare,
class Alloc>
299 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept;
300template <
class Hasher,
class Key,
class Compare,
class Alloc>
304 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept;
305template <
class Hasher,
class T0,
class T1,
class... T>
307hash_append(Hasher& h, T0
const& t0, T1
const& t1, T
const&... t)
noexcept;
311template <
class Hasher,
class T, std::
size_t N>
315 for (
auto const& t : a)
321template <
class Hasher,
class CharT,
class Traits,
class Alloc>
332template <
class Hasher,
class CharT,
class Traits,
class Alloc>
338 h(s.data(), s.size() *
sizeof(CharT));
344template <
class Hasher,
class T,
class U>
346 !is_contiguously_hashable<std::pair<T, U>, Hasher>::value>
354template <
class Hasher,
class T,
class Alloc>
358 for (
auto const& t : v)
363template <
class Hasher,
class T,
class Alloc>
367 h(v.data(), v.size() *
sizeof(T));
373template <
class Hasher,
class T, std::
size_t N>
377 for (
auto const& t : a)
381template <
class Hasher,
class Key,
class Compare,
class Alloc>
385 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept
387 for (
auto const& t : v)
390template <
class Hasher,
class Key,
class Compare,
class Alloc>
394 boost::container::flat_set<Key, Compare, Alloc>
const& v)
noexcept
396 h(&(v.begin()), v.size() *
sizeof(Key));
407template <
class Hasher,
class T>
415template <
class Hasher,
class... T,
std::size_t... I>
427template <
class Hasher,
class... T>
429 !is_contiguously_hashable<
std::tuple<T...>, Hasher>::value>
437template <
class Hasher,
class T>
446template <
class Hasher,
class Rep,
class Period>
453template <
class Hasher,
class Clock,
class Duration>
464template <
class Hasher,
class T0,
class T1,
class... T>
466hash_append(Hasher& h, T0
const& t0, T1
const& t1, T
const&... t)
noexcept
474template <
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