Created on 2018-04-17.00:00:00 last changed 45 months ago
Proposed resolution:
This wording is relative to N4741.
Edit [time.duration.nonmember] as indicated:
-1- In the function descriptions that follow, unless stated otherwise, let CD represent
[…]sthe return type of the function.template<class Rep1, class Period1, class Rep2, class Period2> constexpr common_type_t<Rep1, Rep2> operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);Let CD be common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>.
-10- Returns: CD(lhs).count() / CD(rhs).count().
[ 2018-06 Rapperswil: Adopted ]
[ 2018-04-24 Moved to Tentatively Ready after 6 positive votes on c++std-lib. ]
[time.duration.nonmember]/1 states
In the function descriptions that follow, CD represents the return type of the function.
From what I could find, many definitions of CD in the paragraphs of [time.duration.nonmember] were lifted to [time.duration.nonmember]/1 as cited above. That works for all other paragraphs, but not for [time.duration.nonmember]/10, which the change rendered ill-formed:
template<class Rep1, class Period1, class Rep2, class Period2> constexpr common_type_t<Rep1, Rep2> operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);Returns: CD(lhs).count() / CD(rhs).count().
In this case, we want CD to mean common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>. That way, the division has the expected semantics of dividing two quantities of the same dimension.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2018-06-12 01:05:16 | admin | set | messages: + msg9893 |
2018-06-12 01:05:16 | admin | set | status: voting -> wp |
2018-05-06 19:23:13 | admin | set | status: ready -> voting |
2018-05-05 12:25:22 | admin | set | messages: + msg9833 |
2018-05-05 12:25:22 | admin | set | status: new -> ready |
2018-04-22 16:36:38 | admin | set | messages: + msg9828 |
2018-04-17 00:00:00 | admin | create |