Title
Specify weekday_indexed to range of [0, 7]
Status
c++20
Section
[time.cal.wdidx.members]
Submitter
Howard Hinnant

Created on 2019-09-02.00:00:00 last changed 45 months ago

Messages

Date: 2019-09-24.19:35:30

Proposed resolution:

This wording is relative to N4830.

  1. Modify [time.cal.wdidx.members] as indicated:

    [Drafting note: As a drive-by fix a cleanup of "Constructs an object of type weekday_indexed" wording has been applied as well. ]

    constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;
    

    -1- Effects: Constructs an object of type weekday_indexed by initializingInitializes wd_ with wd and index_ with index. The values held are unspecified if !wd.ok() or index is not in the range [10, 57].

Date: 2019-09-24.00:00:00

[ 2019-09-24 Issue Prioritization ]

Status to Tentatively Ready and priority to 0 after six positive votes on the reflector.

Date: 2019-09-02.00:00:00

On one hand, we say that if you try to construct a weekday_indexed with index 0, you get an unspecified index instead ([time.cal.wdidx.members]/p1),:

The values held are unspecified if !wd.ok() or index is not in the range [1, 5].

OTOH, we take pains to pin down year_month_weekday's conversion to sys_days when the index is zero ([time.cal.wdidx.members]/p19):

If index() is 0 the returned sys_days represents the date 7 days prior to the first weekday() of year()/month().

This is inconsistent. We should allow a slightly wider range (say, [0, 7], since you need at least 3 bits anyway to represent the 5 distinct valid values, and the 0 value referred to by [time.cal.wdidx.members]/p19.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2019-11-19 14:48:30adminsetstatus: voting -> wp
2019-10-07 02:48:00adminsetstatus: ready -> voting
2019-09-24 19:35:30adminsetmessages: + msg10668
2019-09-24 19:35:30adminsetstatus: new -> ready
2019-09-14 12:15:17adminsetmessages: + msg10607
2019-09-02 00:00:00admincreate