-
Notifications
You must be signed in to change notification settings - Fork 991
Open
Description
operator/ with two durations as arguments is implemented to return a duration:
Lines 337 to 343 in 7fadbf0
template <typename Rep1, typename Period1, typename Rep2, typename Period2> | |
typename eastl::common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type EASTL_FORCE_INLINE | |
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs) | |
{ | |
typedef typename eastl::common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type common_duration_t; | |
return common_duration_t(common_duration_t(lhs).count() / common_duration_t(rhs).count()); | |
} |
This is wrong; see https://en.cppreference.com/w/cpp/chrono/duration/operator_arith4 (6) - "Note that the return value of this operator is not a duration."
Divison of two durations should return a dimensionless number and not a duration.
Metadata
Metadata
Assignees
Labels
No labels