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

来自cppreference.com
< cpp‎ | chrono‎ | zoned time
 
 
工具库
通用工具
日期和时间
函数对象
格式化库 (C++20)
(C++11)
关系运算符 (C++20 中弃用)
整数比较函数
(C++20)(C++20)(C++20)
(C++20)
swap 与类型运算
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
常用词汇类型
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
初等字符串转换
(C++17)
(C++17)
 
 
 
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* 。否则为 std::remove_cvref_t<TimeZonePtrOrName>