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

Created on 2019-06-23.00:00:00 last changed 38 months ago

Messages

Date: 2020-02-13.12:32:11

Proposed resolution:

This wording is relative to N4849.

  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- Constraints: 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- Constraints: 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: 2020-02-13.12:32:11

[ 2020-02 Status to Immediate on Thursday morning in Prague. ]

Date: 2020-02-15.00:00:00

[ 2020-02-13, Prague ]

During LWG discussions it was suggested to rebase the wording to reduce the chances for confusion.

Date: 2020-02-13.10:43: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.

Previous resolution [SUPERSEDED]:

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]

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: immediate -> wp
2020-02-13 12:32:11adminsetmessages: + msg11055
2020-02-13 12:32:11adminsetstatus: new -> immediate
2020-02-13 10:43:00adminsetmessages: + msg11051
2019-06-23 14:15:50adminsetmessages: + msg10463
2019-06-23 00:00:00admincreate