Deductiongu...::zoned_time(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸŽ€ NAME πŸŽ€

okay so bestie, this is the manual page for Deduction guides for std::chrono::zoned_time, from the C++ Standard Libary manual β€” page name Deductiongu...::zoned_time(3). The NAME line is literally:

Deductionguidesforstd::chrono::zoned_time - Deductionguidesforstd::chrono::zoned_time

like, yes, it says the same thing twice, and honestly? iconic. πŸ’…

✨ Synopsis ✨

here’s the exact synopsis, no edits, no β€œfixing” the line breaks, because code is sacred:

          zoned_time() -> zoned_time<std::chrono::seconds>;
       (1) (since C++20)
          template< class Duration >

          zoned_time( std::chrono::sys_time<Duration> )
       (2) (since C++20)

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

          zoned_time( TimeZonePtrOrName&&, std::chrono::sys_time<Duration> )
       (4) (since C++20)

              -> zoned_time<std::common_type_t<Duration,
          std::chrono::seconds>, /* see below */>;
          template< class TimeZonePtrOrName, class Duration >

          zoned_time( TimeZonePtrOrName&&,
          std::chrono::local_time<Duration>,
       (5) (since C++20)
                      std::chrono::choose = std::chrono::choose::earliest )

              -> zoned_time<std::common_type_t<Duration,
          std::chrono::seconds>, /* see below */>;
          template< class TimeZonePtrOrName, class Duration, class
          TimeZonePtr2 >

          zoned_time( TimeZonePtrOrName&&, std::chrono::zoned_time<Duration,
          TimeZonePtr2>,
       (6) (since C++20)
                      std::chrono::choose = std::chrono::choose::earliest )

              -> zoned_time<std::common_type_t<Duration,
          std::chrono::seconds>, /* see below */>;

All six of these guides are (since C++20), periodt. ✨

So the tea: these deduction guides normalize Duration to a minimum resolution of std::chrono::seconds, and they provide correct handling for time zone names specified using types convertible to std::string_view.

3-6) if std::is_convertible_v<TimeZonePtrOrName, std::string_view> is true, the deduced second template argument is const std::chrono::time_zone*. Otherwise it is std::remove_cvref_t<TimeZonePtrOrName>.

Guide-by-guide, because we love a numbered list:

  1. (1) β€” no arguments: zoned_time() -> zoned_time<std::chrono::seconds>;. Since C++20.
  2. (2) β€” template< class Duration > with zoned_time( std::chrono::sys_time<Duration> ) deduces to zoned_time<std::common_type_t<Duration, std::chrono::seconds>>;. Since C++20.
  3. (3) β€” template< class TimeZonePtrOrName > with zoned_time( TimeZonePtrOrName&& ) -> deduces to zoned_time<std::chrono::seconds, /* see below */>;. Since C++20.
  4. (4) β€” template< class TimeZonePtrOrName, class Duration > with zoned_time( TimeZonePtrOrName&&, std::chrono::sys_time<Duration> ) deduces to zoned_time<std::common_type_t<Duration, std::chrono::seconds>, /* see below */>;. Since C++20.
  5. (5) β€” template< class TimeZonePtrOrName, class Duration > with zoned_time( TimeZonePtrOrName&&, std::chrono::local_time<Duration>, std::chrono::choose = std::chrono::choose::earliest ) deduces to zoned_time<std::common_type_t<Duration, std::chrono::seconds>, /* see below */>;. Since C++20.
  6. (6) β€” template< class TimeZonePtrOrName, class Duration, class TimeZonePtr2 > with zoned_time( TimeZonePtrOrName&&, std::chrono::zoned_time<Duration, TimeZonePtr2>, std::chrono::choose = std::chrono::choose::earliest ) deduces to zoned_time<std::common_type_t<Duration, std::chrono::seconds>, /* see below */>;. Since C++20.

xoxo, your Unix bestie πŸ’– β€” source/version and date: http://cppreference.com, 2024.06.10, manual page Deductiongu...::zoned_time(3). periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from