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

93 lines
3.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[time.hash]
# 30 Time library [[time]](./#time)
## 30.14 Hash support [time.hash]
[🔗](#lib:hash,duration)
`template<class Rep, class Period> struct hash<chrono::duration<Rep, Period>>;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11501)
The specialization hash<chrono::duration<Rep, Period>> is enabled ([[unord.hash]](unord.hash "22.10.19Class template hash"))
if and only if
hash<Rep> is enabled[.](#1.sentence-2)
The member functions are not guaranteed to be noexcept[.](#1.sentence-3)
[🔗](#lib:hash,time_point)
`template<class Clock, class Duration> struct hash<chrono::time_point<Clock, Duration>>;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11514)
The specialization hash<chrono::time_point<Clock, Duration>> is enabled ([[unord.hash]](unord.hash "22.10.19Class template hash"))
if and only if hash<Duration> is enabled[.](#2.sentence-1)
The member functions are not guaranteed to be noexcept[.](#2.sentence-2)
[🔗](#lib:hash,day)
`template<> struct hash<chrono::day>;
template<> struct hash<chrono::month>;
template<> struct hash<chrono::year>;
template<> struct hash<chrono::weekday>;
template<> struct hash<chrono::weekday_indexed>;
template<> struct hash<chrono::weekday_last>;
template<> struct hash<chrono::month_day>;
template<> struct hash<chrono::month_day_last>;
template<> struct hash<chrono::month_weekday>;
template<> struct hash<chrono::month_weekday_last>;
template<> struct hash<chrono::year_month>;
template<> struct hash<chrono::year_month_day>;
template<> struct hash<chrono::year_month_day_last>;
template<> struct hash<chrono::year_month_weekday>;
template<> struct hash<chrono::year_month_weekday_last>;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11554)
The specializations are enabled ([[unord.hash]](unord.hash "22.10.19Class template hash"))[.](#3.sentence-1)
[*Note [1](#note-1)*:
All the hash<Key> specializations listed above meet the[*Cpp17Hash*](hash.requirements#:Cpp17Hash "16.4.4.5Cpp17Hash requirements[hash.requirements]") requirements, even when called on objects k of type Key such that k.ok() is false[.](#3.sentence-2)
— *end note*]
[🔗](#lib:hash,zoned_time)
`template<class Duration, class TimeZonePtr>
struct hash<chrono::zoned_time<Duration, TimeZonePtr>>;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11570)
The specialization hash<chrono::zoned_time<Duration, TimeZonePtr>> is enabled ([[unord.hash]](unord.hash "22.10.19Class template hash"))
if and only if hash<Duration> is enabled andhash<TimeZonePtr> is enabled[.](#4.sentence-1)
The member functions are not guaranteed to be noexcept[.](#4.sentence-2)
[🔗](#lib:hash,leap_second)
`template<> struct hash<chrono::leap_second>;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11584)
The specialization is enabled ([[unord.hash]](unord.hash "22.10.19Class template hash"))[.](#5.sentence-1)