container_hash icon indicating copy to clipboard operation
container_hash copied to clipboard

Unsupported types should be poisoned similarly to the stdlib

Open cmazakas opened this issue 2 years ago • 0 comments

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.

cmazakas avatar Jun 21 '23 15:06 cmazakas