mirror of
https://github.com/HowardHinnant/date.git
synced 2024-12-26 16:01:04 +08:00
Allow zoned_time conversion among different TimeZonePtr types
This commit is contained in:
parent
4b73a42d02
commit
fa6529a2fc
@ -417,8 +417,21 @@ public:
|
||||
#endif
|
||||
zoned_time(TimeZonePtr z, const local_time<Duration>& tp, choose c);
|
||||
|
||||
zoned_time(TimeZonePtr z, const zoned_time& zt);
|
||||
zoned_time(TimeZonePtr z, const zoned_time& zt, choose);
|
||||
template <class Duration2, class TimeZonePtr2,
|
||||
class = typename std::enable_if
|
||||
<
|
||||
std::is_convertible<sys_time<Duration2>,
|
||||
sys_time<Duration>>::value
|
||||
>::type>
|
||||
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& zt);
|
||||
|
||||
template <class Duration2, class TimeZonePtr2,
|
||||
class = typename std::enable_if
|
||||
<
|
||||
std::is_convertible<sys_time<Duration2>,
|
||||
sys_time<Duration>>::value
|
||||
>::type>
|
||||
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& zt, choose);
|
||||
|
||||
#if HAS_STRING_VIEW
|
||||
|
||||
@ -718,6 +731,14 @@ template <class Duration>
|
||||
zoned_time(const char*, local_time<Duration>, choose = choose::earliest)
|
||||
-> zoned_time<std::common_type_t<Duration, std::chrono::seconds>>;
|
||||
|
||||
template <class Duration, class TimeZonePtr, class TimeZonePtr2>
|
||||
zoned_time(TimeZonePtr, zoned_time<Duration, TimeZonePtr2>)
|
||||
-> zoned_time<Duration, TimeZonePtr>;
|
||||
|
||||
template <class Duration, class TimeZonePtr, class TimeZonePtr2>
|
||||
zoned_time(TimeZonePtr, zoned_time<Duration, TimeZonePtr2>, choose)
|
||||
-> zoned_time<Duration, TimeZonePtr>;
|
||||
|
||||
#endif // HAS_DEDUCTION_GUIDES
|
||||
|
||||
template <class Duration1, class Duration2, class TimeZonePtr>
|
||||
@ -1403,17 +1424,19 @@ zoned_time<Duration, TimeZonePtr>::zoned_time(TimeZonePtr z, const local_time<Du
|
||||
{}
|
||||
|
||||
template <class Duration, class TimeZonePtr>
|
||||
template <class Duration2, class TimeZonePtr2, class>
|
||||
inline
|
||||
zoned_time<Duration, TimeZonePtr>::zoned_time(TimeZonePtr z,
|
||||
const zoned_time<Duration, TimeZonePtr>& zt)
|
||||
const zoned_time<Duration2, TimeZonePtr2>& zt)
|
||||
: zone_(std::move(z))
|
||||
, tp_(zt.tp_)
|
||||
{}
|
||||
|
||||
template <class Duration, class TimeZonePtr>
|
||||
template <class Duration2, class TimeZonePtr2, class>
|
||||
inline
|
||||
zoned_time<Duration, TimeZonePtr>::zoned_time(TimeZonePtr z,
|
||||
const zoned_time<Duration, TimeZonePtr>& zt, choose)
|
||||
const zoned_time<Duration2, TimeZonePtr2>& zt, choose)
|
||||
: zoned_time(std::move(z), zt)
|
||||
{}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user