@@ -35,26 +35,25 @@ template <class _Rep, class _Period = ratio<1> >
35
35
class _LIBCPP_TEMPLATE_VIS duration;
36
36
37
37
template <class _Tp >
38
- struct __is_duration : false_type {} ;
38
+ inline const bool __is_duration_v = false ;
39
39
40
40
template <class _Rep , class _Period >
41
- struct __is_duration <duration<_Rep, _Period> > : true_type {} ;
41
+ inline const bool __is_duration_v <duration<_Rep, _Period> > = true ;
42
42
43
43
template <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 ;
45
45
46
46
template <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 ;
48
48
49
49
template <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 ;
51
51
52
52
} // namespace chrono
53
53
54
54
template <class _Rep1 , class _Period1 , class _Rep2 , class _Period2 >
55
55
struct _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;
58
57
};
59
58
60
59
namespace chrono {
@@ -102,7 +101,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> {
102
101
}
103
102
};
104
103
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 >
106
105
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration duration_cast (const duration<_Rep, _Period>& __fd) {
107
106
return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
108
107
}
@@ -124,23 +123,23 @@ struct _LIBCPP_TEMPLATE_VIS duration_values {
124
123
};
125
124
126
125
#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 >
128
127
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration floor (const duration<_Rep, _Period>& __d) {
129
128
_ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
130
129
if (__t > __d)
131
130
__t = __t - _ToDuration{1 };
132
131
return __t ;
133
132
}
134
133
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 >
136
135
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration ceil (const duration<_Rep, _Period>& __d) {
137
136
_ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
138
137
if (__t < __d)
139
138
__t = __t + _ToDuration{1 };
140
139
return __t ;
141
140
}
142
141
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 >
144
143
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round (const duration<_Rep, _Period>& __d) {
145
144
_ToDuration __lower = chrono::floor <_ToDuration>(__d);
146
145
_ToDuration __upper = __lower + _ToDuration{1 };
@@ -158,7 +157,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round(const duration<
158
157
159
158
template <class _Rep , class _Period >
160
159
class _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" );
162
161
static_assert (__is_ratio_v<_Period>, " Second template parameter of duration must be a std::ratio" );
163
162
static_assert (_Period::num > 0 , " duration period must be positive" );
164
163
@@ -434,7 +433,7 @@ operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) {
434
433
template <class _Rep1 ,
435
434
class _Period ,
436
435
class _Rep2 ,
437
- __enable_if_t <!__is_duration <_Rep2>::value &&
436
+ __enable_if_t <!__is_duration_v <_Rep2> &&
438
437
is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
439
438
int > = 0 >
440
439
inline _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
456
455
template <class _Rep1 ,
457
456
class _Period ,
458
457
class _Rep2 ,
459
- __enable_if_t <!__is_duration <_Rep2>::value &&
458
+ __enable_if_t <!__is_duration_v <_Rep2> &&
460
459
is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
461
460
int > = 0 >
462
461
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
0 commit comments