Title
zoned_time constructor from string_view should accept zoned_time<Duration2, TimeZonePtr2>
Status
new
Section
[time.zone.zonedtime.ctor]
Submitter
Tomasz Kami&nacute;ski

Created on 2019-06-23.00:00:00, last changed 2019-06-23.14:15:50.

Messages

Date: 2019-06-23.14:55:30

Proposed resolution:

This wording is relative to N4820.

  1. Modify [time.zone.zonedtime.overview], class template zoned_time synopsis, as indicated:

    template<class Duration2, class TimeZonePtr2>
    zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& zt);
    template<class Duration2, class TimeZonePtr2>
    zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& zt, choose);
  2. Modify [time.zone.zonedtime.ctor] as indicated:

    template<class Duration2, class TimeZonePtr2>
    zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y);
    

    -32- Remarks: This constructor does not participate in overload resolution unless zoned_time is constructible from the return type of traits::locate_zone(name) and zoned_time<Duration2, TimeZonePtr2>.

    -33- Effects: Equivalent to construction with {traits::locate_zone(name), y}.

    template<class Duration2, class TimeZonePtr2>
    zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y, choose c););
    

    -34- Remarks: This constructor does not participate in overload resolution unless zoned_time is constructible from the return type of traits::locate_zone(name), zoned_time<Duration2, TimeZonePtr2>, and choose.

    -35- Effects: Equivalent to construction with {traits::locate_zone(name), y, c}.

    -36- [Note: The choose parameter has no effect. — end note]

Date: 2019-06-23.00:00:00

zoned_time constructors with string_view and another zoned_time are not accepting zoned_time instances that use a different time zone representation (TimeZonePtr parameter):

zoned_time(string_view name, const zoned_time<Duration>& zt);
zoned_time(string_view name, const zoned_time<Duration>& zt, choose);

This makes them inconsistent with the constructors from TimeZonePtr and zoned_time, that they delegate to:

template<class Duration2, class TimeZonePtr2>
  zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& zt);
template<class Duration2, class TimeZonePtr2>
  zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& zt, choose);

Furthermore it forces the creation of a temporary zoned_time object in case when the source uses the same TimeZonePtr, but different Duration.

History
Date User Action Args
2019-06-23 14:15:50adminsetmessages: + msg10463
2019-06-23 00:00:00admincreate