Created on 2022-12-14.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4917.
Modify [time.format] as indicated:
-1- […]
The productions fill-and-align, width, and precision are described in [format.string]. Giving a precision specification in the chrono-format-spec is valid only for types that are specializations of std::chrono::durationtypes where the representation type Rep isfor which the nested typedef-name rep denotes a floating-point type. For all otherReptypes, an exception of type format_error is thrown if the chrono-format-spec contains a precision specification. […]
[ 2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Voting → WP. ]
[ 2023-01-06; Reflector poll ]
Set status to Tentatively Ready after eight votes in favour during reflector poll.
[time.format] says:
[…] Giving a precision specification in the chrono-format-spec is valid only for std::chrono::duration types where the representation type Rep is a floating-point type. For all other Rep types, an exception of type format_error is thrown if the chrono-format-spec contains a precision specification. […]
It's unclear whether the restriction in the first sentence applies to all types, or only duration types. The second sentence seems to restrict the exceptional case to only types with a non-floating-point Rep, but what about types with no Rep type at all?
Can you use a precision with sys_time<duration<float>>? That is not a duration type at all, so does the restriction apply? What about hh_mm_ss<duration<int>>? That's not a duration type, but it uses one, and its Rep is not a floating-point type. What about sys_info? That's not a duration and doesn't have any associated duration, or Rep type. What is the intention here? Less importantly, I don't like the use of Rep here. That's the template parameter of the duration class template, but that name isn't in scope here. Why aren't we talking about the duration type's rep type, which is the public name for it? Or about a concrete specialization duration<Rep, Period>, instead of the class template? The suggested change below would preserve the intended meaning, but with more … precision.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2023-02-13 10:17:57 | admin | set | messages: + msg13367 |
2023-02-13 10:17:57 | admin | set | status: voting -> wp |
2023-02-06 15:33:48 | admin | set | status: ready -> voting |
2023-01-06 14:39:35 | admin | set | messages: + msg13169 |
2023-01-06 14:39:35 | admin | set | status: new -> ready |
2022-12-17 14:12:32 | admin | set | messages: + msg13159 |
2022-12-14 00:00:00 | admin | create |