Created on 2009-07-18.00:00:00 last changed 161 months ago
[ This proposed resolution addresses 947 and 974. ]
Change [time.duration.cons] (and reorder the Remarks paragraphs per [structure.specifications]):
template <class Rep2> explicit duration(const Rep2& r);
Requires:Remarks: This constructor shall not participate in overload resolution unless Rep2shall beis implicitly convertible to rep and
- treat_as_floating_point<rep>::value
shall beis true, or- treat_as_floating_point<Rep2>::value
shall beis false.
Diagnostic required[Example:duration<int, milli> d(3); // OK duration<int, milli> d(3.5); // error— end example]
Effects: Constructs an object of type duration.
Postcondition: count() == static_cast<rep>(r).
template <class Rep2, class Period2> duration(const duration<Rep2, Period2>& d);
Requires:Remarks: This constructor shall not participate in overload resolution unless treat_as_floating_point<rep>::valueshall beis true or ratio_divide<Period2, period>::type::denshall beis 1.Diagnostic required.[Note: This requirement prevents implicit truncation error when converting between integral-based duration types. Such a construction could easily lead to confusion about the value of the duration. — end note] [Example:duration<int, milli> ms(3); duration<int, micro> us = ms; // OK duration<int, milli> ms2 = us; // error— end example]
Effects: Constructs an object of type duration, constructing rep_ from duration_cast<duration>(d).count().
Change the following paragraphs in [time.duration.nonmember]:
template <class Rep1, class Period, class Rep2> duration<typename common_type<Rep1, Rep2>::type, Period> operator*(const duration<Rep1, Period>& d, const Rep2& s);
RequiresRemarks: This operator shall not participate in overload resolution unless Rep2shall beis implicitly convertible to CR(Rep1, Rep2).Diagnostic required.template <class Rep1, class Period, class Rep2> duration<typename common_type<Rep1, Rep2>::type, Period> operator*(const Rep1& s, const duration<Rep2, Period>& d);
RequiresRemarks: This operator shall not participate in overload resolution unless Rep1shall beis implicitly convertible to CR(Rep1, Rep2).Diagnostic required.template <class Rep1, class Period, class Rep2> duration<typename common_type<Rep1, Rep2>::type, Period> operator/(const duration<Rep1, Period>& d, const Rep2& s);
RequiresRemarks: This operator shall not participate in overload resolution unless Rep2shall beis implicitly convertible to CR(Rep1, Rep2) and Rep2shall not beis not an instantiation of duration.Diagnostic required.template <class Rep1, class Period, class Rep2> duration<typename common_type<Rep1, Rep2>::type, Period> operator%(const duration<Rep1, Period>& d, const Rep2& s);
RequiresRemarks: This operator shall not participate in overload resolution unless Rep2shall beis implicitly convertible to CR(Rep1, Rep2) and Rep2shall not beis not an instantiation of duration.Diagnostic required.
Change the following paragraphs in [time.duration.cast]:
template <class ToDuration, class Rep, class Period> ToDuration duration_cast(const duration<Rep, Period>& d);
RequiresRemarks: This function shall not participate in overload resolution unless ToDurationshall beis an instantiation of duration.Diagnostic required.
Change [time.point.cons]/3 as indicated:
Requires: Duration2 shall be implicitly convertible to duration. Diagnostic required.Remarks: This constructor shall not participate in overload resolution unless Duration2 is implicitly convertible to duration.
Change the following paragraphs in [time.point.cast]:
template <class ToDuration, class Clock, class Duration> time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
RequiresRemarks: This function shall not participate in overload resolution unless ToDurationshall beis an instantiation of duration.Diagnostic required.
[ 2009-11-22 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]
[ 2009-11-20 Howard adds: ]
I've updated the wording to match Jens' suggestion.
[ 2009-11-19 Jens adds: ]
Further wording suggestion using "unless":
This signature shall not participate in overload resolution unless Rep2 is implicitly convertible to CR(Rep1, Rep2).
[ 2009-11-19 Howard adds: ]
I've updated the wording to match Pete's suggestion and included bullet 16 from 1195.
[ 2009-11-19 Pete opens: ]
Oh, and speaking of 1177, most of the changes result in rather convoluted prose. Instead of saying
A shall be B, else C
it should be
C if A is not B
That is:
Rep2 shall be implicitly convertible to CR(Rep1, Rep2), else this signature shall not participate in overload resolution.
should be
This signature shall not participate in overload resolution if Rep2 is not implicitly convertible to CR(Rep1, Rep2).
That is clearer, and eliminates the false requirement that Rep2 "shall be" convertible.
[ 2009-10 Santa Cruz: ]
Moved to Ready.
"diagnostic required" has been used (by me) for code words meaning "use enable_if to constrain templated functions. This needs to be improved by referring to the function signature as not participating in the overload set, and moving this wording to a Remarks paragraph.
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-08-23 20:07:26 | admin | set | status: wp -> c++11 |
2010-10-21 18:28:33 | admin | set | messages: + msg1029 |
2010-10-21 18:28:33 | admin | set | messages: + msg1028 |
2010-10-21 18:28:33 | admin | set | messages: + msg1027 |
2010-10-21 18:28:33 | admin | set | messages: + msg1026 |
2010-10-21 18:28:33 | admin | set | messages: + msg1025 |
2010-10-21 18:28:33 | admin | set | messages: + msg1024 |
2010-10-21 18:28:33 | admin | set | messages: + msg1023 |
2009-07-18 00:00:00 | admin | create |