26 lines
856 B
Markdown
26 lines
856 B
Markdown
[optional.hash]
|
||
|
||
# 22 General utilities library [[utilities]](./#utilities)
|
||
|
||
## 22.5 Optional objects [[optional]](optional#hash)
|
||
|
||
### 22.5.11 Hash support [optional.hash]
|
||
|
||
[ð](#lib:hash,optional)
|
||
|
||
`template<class T> struct hash<optional<T>>;
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L5517)
|
||
|
||
The specialization hash<optional<T>> is enabled ([[unord.hash]](unord.hash "22.10.19 Class template hash"))
|
||
if and only if hash<remove_const_t<T>> is enabled[.](#1.sentence-1)
|
||
|
||
When enabled, for an object o of type optional<T>,
|
||
if o.has_value() == true, then hash<optional<T>>()(o) evaluates to the same value as hash<remove_const_t<T>>()(*o);
|
||
otherwise it evaluates to an unspecified value[.](#1.sentence-2)
|
||
|
||
The member functions are not guaranteed to be noexcept[.](#1.sentence-3)
|