Skip to content

Commit

Permalink
std::hash for strong<T, Tag>
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Apr 19, 2023
1 parent 7db292a commit b9b3a54
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/cista/strong.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <limits>
#include <ostream>
#include <type_traits>
#include <utility>

namespace cista {

Expand Down Expand Up @@ -187,4 +188,11 @@ class numeric_limits<cista::strong<T, Tag>> {
static constexpr bool is_integer = std::is_integral_v<T>;
};

template <typename T, typename Tag>
struct hash<cista::strong<T, Tag>> {
size_t operator()(cista::strong<T, Tag> const& t) const {
return hash<T>{}(t.v_);
}
};

} // namespace std

0 comments on commit b9b3a54

Please sign in to comment.