[llvm-branch-commits] [libcxx] [libc++][TZDB] Finishes zoned_time constructors. (PR #95010)
Louis Dionne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jun 18 09:00:00 PDT 2024
================
@@ -76,12 +81,71 @@ class zoned_time {
_LIBCPP_HIDE_FROM_ABI explicit zoned_time(string_view __name)
requires(requires { __traits::locate_zone(string_view{}); } &&
- // constructible_from<zoned_time, decltype(__traits::locate_zone(string_view{}))>
- // would create a dependency on itself. Instead depend on the fact
- // a constructor taking a _TimeZonePtr exists.
constructible_from<_TimeZonePtr, decltype(__traits::locate_zone(string_view{}))>)
: __zone_{__traits::locate_zone(__name)}, __tp_{} {}
+ template <class _Duration2>
+ _LIBCPP_HIDE_FROM_ABI zoned_time(const zoned_time<_Duration2, _TimeZonePtr>& __zt)
+ requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>
+ : __zone_{__zt.get_time_zone()}, __tp_{__zt.get_sys_time()} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const sys_time<_Duration>& __tp)
+ : __zone_{std::move(__zone)}, __tp_{__tp} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const sys_time<_Duration>& __tp)
+ requires requires { _TimeZonePtr{__traits::locate_zone(string_view{})}; }
----------------
ldionne wrote:
Similar comment about the constraint here.
https://github.com/llvm/llvm-project/pull/95010
More information about the llvm-branch-commits
mailing list