Files
cppdraft_translate/cppdraft/optional/hash.md
2025-10-25 03:02:53 +03:00

856 B

[optional.hash]

22 General utilities library [utilities]

22.5 Optional objects [optional]

22.5.11 Hash support [optional.hash]

🔗

template<class T> struct hash<optional<T>>;

1

#

The specialization hash<optional> is enabled ([unord.hash]) if and only if hash<remove_const_t> is enabled.

When enabled, for an object o of type optional, if o.has_value() == true, then hash<optional>()(o) evaluates to the same value as hash<remove_const_t>()(*o); otherwise it evaluates to an unspecified value.

The member functions are not guaranteed to be noexcept.