20#ifndef PALUDIS_GUARD_PALUDIS_UTIL_HASHES_HH
21#define PALUDIS_GUARD_PALUDIS_UTIL_HASHES_HH 1
24#include <paludis/util/wrapped_value-fwd.hh>
25#include <paludis/util/fs_path-fwd.hh>
35 namespace hash_internals
37 template <
typename T_,
bool is_numeric_>
40 static std::size_t hash(
const T_ & t)
42 return static_cast<std::size_t
>(t);
46 template <
typename T_>
49 static std::size_t hash(
const T_ & t)
56 template <
typename T_>
60 std::size_t operator() (
const T_ & t)
const
69 std::size_t operator() (
const std::string &)
const PALUDIS_ATTRIBUTE((warn_unused_result));
78 template <
typename T_,
typename U_>
79 struct Hash<std::pair<T_, U_> >
81 std::size_t operator() (
const std::pair<T_, U_> & p)
const
87 template <
unsigned n_,
typename... Keys_>
88 std::size_t single_tuple_hash(
const std::tuple<Keys_...> & p)
90 return Hash<
typename std::tuple_element<n_, std::tuple<Keys_...> >::type>()(std::get<n_>(p));
101 template <
unsigned n_,
typename... Keys_>
102 std::size_t accumulate_tuple_hash(
const std::tuple<Keys_...> &, std::size_t v,
const FinishedHashingTuple &)
107 template <
unsigned n_,
typename... Keys_>
108 std::size_t accumulate_tuple_hash(
const std::tuple<Keys_...> & p, std::size_t v,
const NotFinishedHashingTuple &)
110 return accumulate_tuple_hash<n_ + 1, Keys_...>(p, (v << 8) ^ single_tuple_hash<n_>(p),
111 typename std::conditional<std::tuple_size<std::tuple<Keys_...> >::value == n_ + 1,
112 FinishedHashingTuple, NotFinishedHashingTuple>::type());
115 template <
typename... Keys_>
116 struct Hash<std::tuple<Keys_...> >
118 std::size_t operator() (
const std::tuple<Keys_...> & p)
const
124 template <
typename Tag_>
133 template <
typename T_>
136 std::size_t operator() (
const T_ & t)
const
142 template <
typename T_>
145 std::size_t operator() (
const T_ & t)
const
151 template <
typename T_>
154 std::size_t operator() (
const T_ *
const t)
const
160 template <
typename T_>
161 struct Hash<std::shared_ptr<T_> >
163 std::size_t operator() (
const std::shared_ptr<const T_> & t)
const
Definition wrapped_value.hh:45
#define PALUDIS_ATTRIBUTE(x)
Definition attributes.hh:53
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition about_metadata-fwd.hh:24