boostorg / container_hash

Generic hash function for STL style unordered containers
https://boost.org/libs/container_hash
29 stars 39 forks source link

Unsupported types should be poisoned similarly to the stdlib #33

Open cmazakas opened 1 year ago

cmazakas commented 1 year ago

Consider https://godbolt.org/z/5W1x94aTh

We see that:

static_assert(std::is_invocable_v<std::hash<rawr>, rawr>);

correctly fails until

template<>
struct std::hash<rawr> {
  std::size_t operator()(rawr const&) const noexcept { return 0; }
};

is defined.

This would enable downstream consumers to write simple is_hashable trait checks.