@@ -35,26 +35,25 @@ template <class _Rep, class _Period = ratio<1> >
3535class _LIBCPP_TEMPLATE_VIS duration;
3636
3737template <class _Tp >
38- struct __is_duration : false_type {} ;
38+ inline const bool __is_duration_v = false ;
3939
4040template <class _Rep , class _Period >
41- struct __is_duration <duration<_Rep, _Period> > : true_type {} ;
41+ inline const bool __is_duration_v <duration<_Rep, _Period> > = true ;
4242
4343template <class _Rep , class _Period >
44- struct __is_duration <const duration<_Rep, _Period> > : true_type {} ;
44+ inline const bool __is_duration_v <const duration<_Rep, _Period> > = true ;
4545
4646template <class _Rep , class _Period >
47- struct __is_duration <volatile duration<_Rep, _Period> > : true_type {} ;
47+ inline const bool __is_duration_v <volatile duration<_Rep, _Period> > = true ;
4848
4949template <class _Rep , class _Period >
50- struct __is_duration <const volatile duration<_Rep, _Period> > : true_type {} ;
50+ inline const bool __is_duration_v <const volatile duration<_Rep, _Period> > = true ;
5151
5252} // namespace chrono
5353
5454template <class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
5555struct _LIBCPP_TEMPLATE_VIS common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> > {
56- typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, typename __ratio_gcd<_Period1, _Period2>::type>
57- type;
56+ typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, __ratio_gcd<_Period1, _Period2> > type;
5857};
5958
6059namespace chrono {
@@ -102,7 +101,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> {
102101 }
103102};
104103
105- template <class _ToDuration , class _Rep , class _Period , __enable_if_t <__is_duration <_ToDuration>::value , int > = 0 >
104+ template <class _ToDuration , class _Rep , class _Period , __enable_if_t <__is_duration_v <_ToDuration>, int > = 0 >
106105inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration duration_cast (const duration<_Rep, _Period>& __fd) {
107106 return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
108107}
@@ -124,23 +123,23 @@ struct _LIBCPP_TEMPLATE_VIS duration_values {
124123};
125124
126125#if _LIBCPP_STD_VER >= 17
127- template <class _ToDuration , class _Rep , class _Period , enable_if_t <__is_duration <_ToDuration>::value , int > = 0 >
126+ template <class _ToDuration , class _Rep , class _Period , enable_if_t <__is_duration_v <_ToDuration>, int > = 0 >
128127inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration floor (const duration<_Rep, _Period>& __d) {
129128 _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
130129 if (__t > __d)
131130 __t = __t - _ToDuration{1 };
132131 return __t ;
133132}
134133
135- template <class _ToDuration , class _Rep , class _Period , enable_if_t <__is_duration <_ToDuration>::value , int > = 0 >
134+ template <class _ToDuration , class _Rep , class _Period , enable_if_t <__is_duration_v <_ToDuration>, int > = 0 >
136135inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration ceil (const duration<_Rep, _Period>& __d) {
137136 _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
138137 if (__t < __d)
139138 __t = __t + _ToDuration{1 };
140139 return __t ;
141140}
142141
143- template <class _ToDuration , class _Rep , class _Period , enable_if_t <__is_duration <_ToDuration>::value , int > = 0 >
142+ template <class _ToDuration , class _Rep , class _Period , enable_if_t <__is_duration_v <_ToDuration>, int > = 0 >
144143inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round (const duration<_Rep, _Period>& __d) {
145144 _ToDuration __lower = chrono::floor<_ToDuration>(__d);
146145 _ToDuration __upper = __lower + _ToDuration{1 };
@@ -158,7 +157,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round(const duration<
158157
159158template <class _Rep , class _Period >
160159class _LIBCPP_TEMPLATE_VIS duration {
161- static_assert (!__is_duration <_Rep>::value , " A duration representation can not be a duration" );
160+ static_assert (!__is_duration_v <_Rep>, " A duration representation can not be a duration" );
162161 static_assert (__is_ratio_v<_Period>, " Second template parameter of duration must be a std::ratio" );
163162 static_assert (_Period::num > 0 , " duration period must be positive" );
164163
@@ -434,7 +433,7 @@ operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) {
434433template <class _Rep1 ,
435434 class _Period ,
436435 class _Rep2 ,
437- __enable_if_t <!__is_duration <_Rep2>::value &&
436+ __enable_if_t <!__is_duration_v <_Rep2> &&
438437 is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
439438 int > = 0 >
440439inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
@@ -456,7 +455,7 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
456455template <class _Rep1 ,
457456 class _Period ,
458457 class _Rep2 ,
459- __enable_if_t <!__is_duration <_Rep2>::value &&
458+ __enable_if_t <!__is_duration_v <_Rep2> &&
460459 is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
461460 int > = 0 >
462461inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
0 commit comments