duration::operator*
has template parameters in funny orderSection: 30.5.6 [time.duration.nonmember] Status: C++11 Submitter: P.J. Plauger Opened: 2010-10-14 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [time.duration.nonmember].
View all issues with C++11 status.
Discussion:
In [time] and [time.duration.nonmember] we have:
template <class Rep1, class Period, class Rep2> duration<typename common_type<Rep1, Rep2>::type, Period> operator*(const Rep1& s, const duration<Rep2, Period>& d);
Everywhere else, we always have <rep, period>
in that order for a given
type. But here, we have Period
and Rep2
in reverse order for
<Rep2, Period>
. This is probably of little importance, since the
template parameters are seldom spelled out for a function like this. But changing it
now will eliminate a potential source of future errors and confusion.
Proposed resolution:
Change the signature in [time] and [time.duration.nonmember] to:
template <class Rep1, classPeriodRep2, classRep2Period> duration<typename common_type<Rep1, Rep2>::type, Period> operator*(const Rep1& s, const duration<Rep2, Period>& d);