Title
duration constructor from representation shouldn't be effectively non-throwing
Status
wp
Section
[time.duration]
Submitter
Johel Ernesto Guerrero Peña

Created on 2018-06-22.00:00:00 last changed 7 days ago

Messages

Date: 2021-10-14.09:56:08

Proposed resolution:

This wording is relative to N4861.

Change [time.duration.cons] as indicated:

template<class Rep2>
  constexpr explicit duration(const Rep2& r);

-1- Constraints: is_convertible_v<const Rep2&, rep> is true and

  1. (1.1) — treat_as_floating_point_v<rep> is true or

  2. (1.2) — treat_as_floating_point_v<Rep2> is false.

[Example: […] end example]

-?- Effects: Initializes rep_ with r.

-2- Postconditions: count() == static_cast<rep>(r).

Date: 2021-10-14.00:00:00

[ 2021-10-14 Approved at October 2021 virtual plenary. Status changed: Voting → WP. ]

Date: 2021-09-15.00:00:00

[ 2021-09-20; Reflector poll ]

Set status to Tentatively Ready after seven votes in favour during reflector poll.

Date: 2020-05-15.00:00:00

[ 2020-05-02; Daniel resyncs wording with recent working draft ]

Date: 2018-06-27.00:00:00

[ 2018-06-27 after reflector discussion ]

Priority set to 3. Improved wording as result of that discussion.

Previous resolution [SUPERSEDED]:

This wording is relative to N4750.

Change [time.duration.cons] as indicated:

template<class Rep2>
  constexpr explicit duration(const Rep2& r);

-1- Remarks: This constructor shall not participate in overload resolution unless […]

-2- Effects: Constructs an object of type durationInitializes rep_ with r.

-3- Postconditions: count() == static_cast<rep>(r).

Date: 2018-06-27.19:02:12

[time.duration]/4 states:

Members of duration shall not throw exceptions other than those thrown by the indicated operations on their representations.

Where representation is defined in the non-normative, brief description at [time.duration]/1:

[…] A duration has a representation which holds a count of ticks and a tick period. […]

[time.duration.cons]/2 doesn't indicate the operation undergone by its representation, merely stating a postcondition in [time.duration.cons]/3:

Effects: Constructs an object of type duration.

Postconditions: count() == static_cast<rep>(r).

I suggest this reformulation that follows the format of [time.duration.cons]/5.

Effects: Constructs an object of type duration, constructing rep_ from r.

Now it is clear why the constructor would throw.

Previous resolution [SUPERSEDED]:

This wording is relative to N4750.

Change [time.duration.cons] as indicated:

template<class Rep2>
  constexpr explicit duration(const Rep2& r);

-1- Remarks: This constructor shall not participate in overload resolution unless […]

-2- Effects: Constructs an object of type duration, constructing rep_ from r.

-3- Postconditions: count() == static_cast<rep>(r).

History
Date User Action Args
2021-10-14 09:56:08adminsetmessages: + msg12111
2021-10-14 09:56:08adminsetstatus: voting -> wp
2021-09-29 12:57:28adminsetstatus: ready -> voting
2021-09-20 11:25:56adminsetmessages: + msg12056
2021-09-20 11:25:56adminsetstatus: new -> ready
2020-05-02 12:25:18adminsetmessages: + msg11255
2018-06-27 19:02:12adminsetmessages: + msg9995
2018-06-24 11:12:30adminsetmessages: + msg9982
2018-06-22 00:00:00admincreate