std::chrono::zoned_time 的推导指引

来自cppreference.com
< cpp‎ | chrono‎ | zoned time
 
 
 
日期和时间工具
(C++11)
(C++11)
时钟
(C++20)
                                                  
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
日历
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
时区
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
C 风格日期和时间
 
 
zoned_time() -> zoned_time<std::chrono::seconds>;
(1) (C++20 起)
template< class Duration >

zoned_time(std::chrono::sys_time<Duration>)

    -> zoned_time<std::common_type_t<Duration, std::chrono::seconds>>;
(2) (C++20 起)
template< class TimeZonePtrOrName >
zoned_time(TimeZonePtrOrName) -> zoned_time<std::chrono::seconds, /* see below */>;
(3) (C++20 起)
template< class TimeZonePtrOrName, class Duration >

zoned_time(TimeZonePtrOrName, std::chrono::sys_time<Duration>)

    -> zoned_time<std::common_type_t<Duration, std::chrono::seconds>, /* see below */>;
(4) (C++20 起)
template< class TimeZonePtrOrName, class Duration >

zoned_time(TimeZonePtrOrName, std::chrono::local_time<Duration>,
           std::chrono::choose = std::chrono::choose::earliest)

    -> zoned_time<std::common_type_t<Duration, std::chrono::seconds>, /* see below */>;
(5) (C++20 起)
template< class TimeZonePtrOrName, class Duration, class TimeZonePtr2 >

zoned_time(TimeZonePtrOrName, std::chrono::zoned_time<Duration, TimeZonePtr2>,
           std::chrono::choose = std::chrono::choose::earliest)

    -> zoned_time<std::common_type_t<Duration, std::chrono::seconds>, /* see below */>;
(6) (C++20 起)

zoned_time 提供六个推导指引。它们把 Duration 正规化为最小解析为 std::chrono::seconds ,并提供用可转换成 std::string_view 的类型指定时区名的正确处理。

3-6)std::is_convertible_v<TimeZonePtrOrName, std::string_view>true ,则推导的第二模板实参为 const std::chrono::time_zone* 。否则为 TimeZonePtrOrName