| Doc. no.: | N4389 |
|---|---|
| Date: | 2015-02-23 |
| Project: | Programming Language C++, Library Working Group |
| Revises: | N4334 |
| Reply-to: | Zhihao Yuan <zy at miator dot net> |
Rationale seehttps://issues.isocpp.org/show_bug.cgi?id=51.
This paper consolidatesN4334 with LWG’s wording improvements to<ratio>.
This wording is relative to N4296.
Modify 20.10.2 [meta.type.synop]:
namespace std { // 20.10.3, helper class: template <class T, T v> struct integral_constant;…
Modify 20.10.3 [meta.help]:
namespace std { template <class T, T v> struct integral_constant {…
};}The class template
integral_constant, alias templatebool_constant, and its associated typedefstrue_typeandfalse_typeare used as base classes to define the interface for various type traits.
Modify Table 49 in 20.10.4.3 [meta.unary.prop]:
| template <class T> struct is_signed; | Ifis_arithmetic<T>::value istrue, the same result as | |
| template <class T> struct is_unsigned; | Ifis_arithmetic<T>::value istrue, the same result as |
Modify 20.11.5 [ratio.comparison]:
template <class R1, class R2> struct ratio_equalIfR1::num == R2::num andR1::den == R2::den,ratio_equal<R1, R2>shall be derived fromintegral_constant<bool, true>; otherwise it shall be derived fromintegral_constant<bool, false>.
template <class R1, class R2> struct ratio_not_equaltemplate <class R1, class R2> struct ratio_lessIf
R1::num * R2::den < R2::num * R1::denR1::num ×R2::den is less thanR2::num ×R1::den ,ratio_less<R1, R2>shall be derived fromintegral_constant<bool, true>bool_constant<true> ; otherwise it shall be derived fromintegral_constant<bool, false>bool_constant<false> . Implementations may use other algorithms to compute this relationship to avoid overflow. If overflow occurs, the program is ill-formed.
Thanks Tony Van Eerd for bringing this to the reflector.