Skip to content

Commit

Permalink
introduced hasher for Void
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed Sep 15, 2022
1 parent 7164fd0 commit ebfe297
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ttg/ttg/util/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,16 @@ namespace ttg {
template <>
struct hash<void, void> {
auto operator()() const { return detail::FNVhasher::initial_value(); }
// convenient to be able to hash Void using hash<void>
auto operator()(const ttg::Void&) const { return operator()(); }
};

/// instantiation of hash for Void
template <>
struct hash<Void, void> {
auto operator()(const ttg::Void&) const { return hash<void>{}(); }
};

/// instantiation of hash for integral types smaller or equal to size_t
template <typename T>
struct hash<T, std::enable_if_t<std::is_integral_v<std::decay_t<T>> && sizeof(T) <= sizeof(std::size_t), void>> {
Expand Down

0 comments on commit ebfe297

Please sign in to comment.