std::hash<T>

Hash support so strong types can be keys in unordered containers.

Synopsis

Declared in <folly/lang/Strong.h>

template<typename T>
requires (
      folly::is_strong<T> &&
      // Required for `folly::is_hashable_v` to be correct.
      requires(typename T::underlying_type underlying) {
        {
          std::hash<typename T::underlying_type>{}(underlying)
        } -> std::convertible_to<std::size_t>;
      })
struct hash<T>;

Description

A strong type is hashable iff the underlying type is.

Member Functions

NameDescription
operator() Hash a strong value by hashing its underlying value.