This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

2004. duration::operator* has template parameters in funny order

Section: 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, class PeriodRep2, class Rep2Period>
    duration<typename common_type<Rep1, Rep2>::type, Period>
        operator*(const Rep1& s, const duration<Rep2, Period>& d);