Title
duration::operator* has template parameters in funny order
Status
c++11
Section
[time.duration.nonmember]
Submitter
P.J. Plauger

Created on 2010-10-14.00:00:00 last changed 161 months ago

Messages

Date: 2010-10-29.14:46:33

Proposed resolution:

Change the signature in [time] and [time.duration.nonmember] to:

template <class Rep1, class PeriodRep2, class Rep2Period>
    duration<typename common_type<Rep1, Rep2>::type, Period>
        operator*(const Rep1& s, const duration<Rep2, Period>& d);
Date: 2010-10-14.00:00:00

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.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2011-04-11 11:23:23adminsetstatus: voting -> wp
2011-03-05 15:24:28adminsetstatus: ready -> voting
2010-11-13 23:03:59adminsetstatus: new -> ready
2010-10-29 14:46:33adminsetmessages: + msg5191
2010-10-14 00:00:00admincreate