30 #ifndef _GLIBCXX_CHRONO
31 #define _GLIBCXX_CHRONO 1
33 #pragma GCC system_header
35 #if __cplusplus < 201103L
44 #if __cplusplus > 201703L
49 namespace std _GLIBCXX_VISIBILITY(default)
51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
53 #if __cplusplus >= 201703L
54 namespace filesystem {
struct __file_clock; };
70 template<
typename _Rep,
typename _Period = ratio<1>>
73 template<
typename _Clock,
typename _Dur =
typename _Clock::duration>
81 template<
typename _CT,
typename _Period1,
typename _Period2,
typename =
void>
82 struct __duration_common_type
85 template<
typename _CT,
typename _Period1,
typename _Period2>
86 struct __duration_common_type<_CT, _Period1, _Period2,
87 __void_t<typename _CT::type>>
90 using __gcd_num = __static_gcd<_Period1::num, _Period2::num>;
91 using __gcd_den = __static_gcd<_Period1::den, _Period2::den>;
92 using __cr =
typename _CT::type;
93 using __r = ratio<__gcd_num::value,
94 (_Period1::den / __gcd_den::value) * _Period2::den>;
97 using type = chrono::duration<__cr, typename __r::type>;
104 template<
typename _Rep1,
typename _Period1,
typename _Rep2,
typename _Period2>
107 : __duration_common_type<common_type<_Rep1, _Rep2>,
108 typename _Period1::type,
109 typename _Period2::type>
114 template<
typename _Rep,
typename _Period>
119 typename _Period::type>;
124 template<
typename _Rep,
typename _Period>
128 typename _Period::type>;
135 template<
typename _CT,
typename _Clock,
typename =
void>
136 struct __timepoint_common_type
139 template<
typename _CT,
typename _Clock>
140 struct __timepoint_common_type<_CT, _Clock, __void_t<typename _CT::type>>
142 using type = chrono::time_point<_Clock, typename _CT::type>;
149 template<
typename _Clock,
typename _Duration1,
typename _Duration2>
152 : __timepoint_common_type<common_type<_Duration1, _Duration2>, _Clock>
157 template<
typename _Clock,
typename _Duration>
164 template<
typename _Clock,
typename _Duration>
178 template<
typename _ToDur,
typename _CF,
typename _CR,
179 bool _NumIsOne =
false,
bool _DenIsOne =
false>
180 struct __duration_cast_impl
182 template<
typename _Rep,
typename _Period>
183 static constexpr _ToDur
184 __cast(
const duration<_Rep, _Period>& __d)
186 typedef typename _ToDur::rep __to_rep;
187 return _ToDur(
static_cast<__to_rep
>(
static_cast<_CR
>(__d.count())
188 *
static_cast<_CR
>(_CF::num)
189 /
static_cast<_CR
>(_CF::den)));
193 template<
typename _ToDur,
typename _CF,
typename _CR>
194 struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
196 template<
typename _Rep,
typename _Period>
197 static constexpr _ToDur
198 __cast(
const duration<_Rep, _Period>& __d)
200 typedef typename _ToDur::rep __to_rep;
201 return _ToDur(
static_cast<__to_rep
>(__d.count()));
205 template<
typename _ToDur,
typename _CF,
typename _CR>
206 struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
208 template<
typename _Rep,
typename _Period>
209 static constexpr _ToDur
210 __cast(
const duration<_Rep, _Period>& __d)
212 typedef typename _ToDur::rep __to_rep;
213 return _ToDur(
static_cast<__to_rep
>(
214 static_cast<_CR
>(__d.count()) /
static_cast<_CR
>(_CF::den)));
218 template<
typename _ToDur,
typename _CF,
typename _CR>
219 struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
221 template<
typename _Rep,
typename _Period>
222 static constexpr _ToDur
223 __cast(
const duration<_Rep, _Period>& __d)
225 typedef typename _ToDur::rep __to_rep;
226 return _ToDur(
static_cast<__to_rep
>(
227 static_cast<_CR
>(__d.count()) *
static_cast<_CR
>(_CF::num)));
231 template<
typename _Tp>
236 template<
typename _Rep,
typename _Period>
237 struct __is_duration<duration<_Rep, _Period>>
241 template<
typename _Tp>
242 using __enable_if_is_duration
243 =
typename enable_if<__is_duration<_Tp>::value, _Tp>::type;
245 template<
typename _Tp>
246 using __disable_if_is_duration
247 =
typename enable_if<!__is_duration<_Tp>::value, _Tp>::type;
252 template<
typename _ToDur,
typename _Rep,
typename _Period>
253 constexpr __enable_if_is_duration<_ToDur>
256 typedef typename _ToDur::period __to_period;
257 typedef typename _ToDur::rep __to_rep;
261 typedef __duration_cast_impl<_ToDur, __cf, __cr,
262 __cf::num == 1, __cf::den == 1> __dc;
263 return __dc::__cast(__d);
267 template<
typename _Rep>
272 #if __cplusplus > 201402L
273 template <
typename _Rep>
274 inline constexpr
bool treat_as_floating_point_v =
278 #if __cplusplus > 201703L
279 template<
typename _Tp>
282 template<
typename _Tp>
283 inline constexpr
bool is_clock_v = is_clock<_Tp>::value;
285 #if __cpp_lib_concepts
286 template<
typename _Tp>
290 template<
typename _Tp>
293 typename _Tp::period;
294 typename _Tp::duration;
295 typename _Tp::time_point::clock;
296 typename _Tp::time_point::duration;
297 { &_Tp::is_steady } -> same_as<const bool*>;
298 { _Tp::now() } -> same_as<typename _Tp::time_point>;
299 requires same_as<
typename _Tp::duration,
300 duration<typename _Tp::rep, typename _Tp::period>>;
301 requires same_as<
typename _Tp::time_point::duration,
302 typename _Tp::duration>;
307 template<
typename _Tp,
typename =
void>
311 template<
typename _Tp>
312 struct __is_clock_impl<_Tp,
313 void_t<typename _Tp::rep, typename _Tp::period,
314 typename _Tp::duration,
315 typename _Tp::time_point::duration,
316 decltype(_Tp::is_steady),
317 decltype(_Tp::now())>>
318 : __and_<is_same<typename _Tp::duration,
319 duration<typename _Tp::rep, typename _Tp::period>>,
320 is_same<typename _Tp::time_point::duration,
321 typename _Tp::duration>,
322 is_same<decltype(&_Tp::is_steady), const bool*>,
323 is_same<decltype(_Tp::now()), typename _Tp::time_point>>::type
326 template<
typename _Tp>
327 struct is_clock : __is_clock_impl<_Tp>::type
332 #if __cplusplus >= 201703L
333 # define __cpp_lib_chrono 201611
335 template<
typename _ToDur,
typename _Rep,
typename _Period>
336 constexpr __enable_if_is_duration<_ToDur>
337 floor(
const duration<_Rep, _Period>& __d)
339 auto __to = chrono::duration_cast<_ToDur>(__d);
341 return __to - _ToDur{1};
345 template<
typename _ToDur,
typename _Rep,
typename _Period>
346 constexpr __enable_if_is_duration<_ToDur>
347 ceil(
const duration<_Rep, _Period>& __d)
349 auto __to = chrono::duration_cast<_ToDur>(__d);
351 return __to + _ToDur{1};
355 template <
typename _ToDur,
typename _Rep,
typename _Period>
357 __and_<__is_duration<_ToDur>,
358 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
360 round(
const duration<_Rep, _Period>& __d)
362 _ToDur __t0 = chrono::floor<_ToDur>(__d);
363 _ToDur __t1 = __t0 + _ToDur{1};
364 auto __diff0 = __d - __t0;
365 auto __diff1 = __t1 - __d;
366 if (__diff0 == __diff1)
368 if (__t0.count() & 1)
372 else if (__diff0 < __diff1)
377 template<
typename _Rep,
typename _Period>
379 enable_if_t<numeric_limits<_Rep>::is_signed, duration<_Rep, _Period>>
380 abs(duration<_Rep, _Period> __d)
382 if (__d >= __d.zero())
388 namespace __detail {
using chrono::ceil; }
397 template<
typename _Tp,
typename _Up>
399 __ceil_impl(
const _Tp& __t,
const _Up& __u)
401 return (__t < __u) ? (__t + _Tp{1}) : __t;
405 template<
typename _ToDur,
typename _Rep,
typename _Period>
407 ceil(
const duration<_Rep, _Period>& __d)
409 return __detail::__ceil_impl(chrono::duration_cast<_ToDur>(__d), __d);
415 template<
typename _Rep>
418 static constexpr _Rep
422 static constexpr _Rep
426 static constexpr _Rep
433 template<
typename _Tp>
438 template<
intmax_t _Num,
intmax_t _Den>
439 struct __is_ratio<
ratio<_Num, _Den>>
446 template<
typename _Rep,
typename _Period>
450 template<
typename _Rep2>
453 static constexpr intmax_t
454 _S_gcd(intmax_t __m, intmax_t __n) noexcept
458 #if __cplusplus >= 201402L
461 intmax_t __rem = __m % __n;
470 return (__n == 0) ? __m : _S_gcd(__n, __m % __n);
478 template<
typename _R1,
typename _R2,
479 intmax_t __gcd1 = _S_gcd(_R1::num, _R2::num),
480 intmax_t __gcd2 = _S_gcd(_R1::den, _R2::den)>
481 using __divide =
ratio<(_R1::num / __gcd1) * (_R2::den / __gcd2),
482 (_R1::den / __gcd2) * (_R2::num / __gcd1)>;
485 template<
typename _Period2>
492 using period =
typename _Period::type;
494 static_assert(!__is_duration<_Rep>::value,
"rep cannot be a duration");
495 static_assert(__is_ratio<_Period>::value,
496 "period must be a specialization of ratio");
497 static_assert(_Period::num > 0,
"period must be positive");
506 template<
typename _Rep2,
typename = _Require<
508 __or_<__is_float<rep>, __not_<__is_float<_Rep2>>>>>
509 constexpr
explicit duration(
const _Rep2& __rep)
510 : __r(
static_cast<rep
>(__rep)) { }
512 template<
typename _Rep2,
typename _Period2,
typename = _Require<
514 __or_<__is_float<rep>,
515 __and_<__is_harmonic<_Period2>,
516 __not_<__is_float<_Rep2>>>>>>
518 : __r(duration_cast<duration>(__d).count()) { }
575 operator*=(
const rep& __rhs)
582 operator/=(
const rep& __rhs)
589 template<
typename _Rep2 = rep>
593 operator%=(
const rep& __rhs)
599 template<
typename _Rep2 = rep>
629 template<
typename _Rep1,
typename _Period1,
630 typename _Rep2,
typename _Period2>
639 return __cd(__cd(__lhs).count() + __cd(__rhs).count());
643 template<
typename _Rep1,
typename _Period1,
644 typename _Rep2,
typename _Period2>
653 return __cd(__cd(__lhs).count() - __cd(__rhs).count());
664 template<
typename _Rep1,
typename _Rep2,
666 using __common_rep_t =
typename
674 template<
typename _Rep1,
typename _Period,
typename _Rep2>
680 return __cd(__cd(__d).count() * __s);
684 template<
typename _Rep1,
typename _Rep2,
typename _Period>
687 {
return __d * __s; }
689 template<
typename _Rep1,
typename _Period,
typename _Rep2>
696 return __cd(__cd(__d).count() / __s);
699 template<
typename _Rep1,
typename _Period1,
700 typename _Rep2,
typename _Period2>
702 operator/(
const duration<_Rep1, _Period1>& __lhs,
703 const duration<_Rep2, _Period2>& __rhs)
705 typedef duration<_Rep1, _Period1> __dur1;
706 typedef duration<_Rep2, _Period2> __dur2;
708 return __cd(__lhs).count() / __cd(__rhs).count();
712 template<
typename _Rep1,
typename _Period,
typename _Rep2>
714 duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
715 operator%(
const duration<_Rep1, _Period>& __d,
const _Rep2& __s)
717 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
719 return __cd(__cd(__d).count() % __s);
722 template<
typename _Rep1,
typename _Period1,
723 typename _Rep2,
typename _Period2>
724 constexpr
typename common_type<duration<_Rep1, _Period1>,
725 duration<_Rep2, _Period2>>::type
726 operator%(
const duration<_Rep1, _Period1>& __lhs,
727 const duration<_Rep2, _Period2>& __rhs)
729 typedef duration<_Rep1, _Period1> __dur1;
730 typedef duration<_Rep2, _Period2> __dur2;
731 typedef typename common_type<__dur1,__dur2>::type __cd;
732 return __cd(__cd(__lhs).count() % __cd(__rhs).count());
737 template<
typename _Rep1,
typename _Period1,
738 typename _Rep2,
typename _Period2>
740 operator==(
const duration<_Rep1, _Period1>& __lhs,
741 const duration<_Rep2, _Period2>& __rhs)
743 typedef duration<_Rep1, _Period1> __dur1;
744 typedef duration<_Rep2, _Period2> __dur2;
745 typedef typename common_type<__dur1,__dur2>::type __ct;
746 return __ct(__lhs).count() == __ct(__rhs).count();
749 template<
typename _Rep1,
typename _Period1,
750 typename _Rep2,
typename _Period2>
752 operator<(
const duration<_Rep1, _Period1>& __lhs,
753 const duration<_Rep2, _Period2>& __rhs)
755 typedef duration<_Rep1, _Period1> __dur1;
756 typedef duration<_Rep2, _Period2> __dur2;
757 typedef typename common_type<__dur1,__dur2>::type __ct;
758 return __ct(__lhs).count() < __ct(__rhs).count();
761 #if __cpp_lib_three_way_comparison
762 template<
typename _Rep1,
typename _Period1,
763 typename _Rep2,
typename _Period2>
764 requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
766 operator<=>(
const duration<_Rep1, _Period1>& __lhs,
767 const duration<_Rep2, _Period2>& __rhs)
769 using __ct = common_type_t<duration<_Rep1, _Period1>,
770 duration<_Rep2, _Period2>>;
771 return __ct(__lhs).count() <=> __ct(__rhs).count();
774 template<
typename _Rep1,
typename _Period1,
775 typename _Rep2,
typename _Period2>
777 operator!=(
const duration<_Rep1, _Period1>& __lhs,
778 const duration<_Rep2, _Period2>& __rhs)
779 {
return !(__lhs == __rhs); }
782 template<
typename _Rep1,
typename _Period1,
783 typename _Rep2,
typename _Period2>
785 operator<=(
const duration<_Rep1, _Period1>& __lhs,
786 const duration<_Rep2, _Period2>& __rhs)
787 {
return !(__rhs < __lhs); }
789 template<
typename _Rep1,
typename _Period1,
790 typename _Rep2,
typename _Period2>
792 operator>(
const duration<_Rep1, _Period1>& __lhs,
793 const duration<_Rep2, _Period2>& __rhs)
794 {
return __rhs < __lhs; }
796 template<
typename _Rep1,
typename _Period1,
797 typename _Rep2,
typename _Period2>
799 operator>=(
const duration<_Rep1, _Period1>& __lhs,
800 const duration<_Rep2, _Period2>& __rhs)
801 {
return !(__lhs < __rhs); }
805 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
806 # define _GLIBCXX_CHRONO_INT64_T int64_t
807 #elif defined __INT64_TYPE__
808 # define _GLIBCXX_CHRONO_INT64_T __INT64_TYPE__
811 "Representation type for nanoseconds must have at least 64 bits");
812 # define _GLIBCXX_CHRONO_INT64_T long long
833 #if __cplusplus > 201703L
847 #undef _GLIBCXX_CHRONO_INT64_T
850 template<
typename _Clock,
typename _Dur>
853 static_assert(__is_duration<_Dur>::value,
854 "duration must be a specialization of std::chrono::duration");
856 typedef _Clock clock;
857 typedef _Dur duration;
858 typedef typename duration::rep rep;
859 typedef typename duration::period period;
861 constexpr
time_point() : __d(duration::zero())
864 constexpr
explicit time_point(
const duration& __dur)
869 template<
typename _Dur2,
870 typename = _Require<is_convertible<_Dur2, _Dur>>>
872 : __d(__t.time_since_epoch())
877 time_since_epoch()
const
880 #if __cplusplus > 201703L
906 operator+=(
const duration& __dur)
913 operator-=(
const duration& __dur)
933 template<
typename _ToDur,
typename _Clock,
typename _Dur>
939 return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
942 #if __cplusplus > 201402L
943 template<
typename _ToDur,
typename _Clock,
typename _Dur>
946 floor(
const time_point<_Clock, _Dur>& __tp)
948 return time_point<_Clock, _ToDur>{
949 chrono::floor<_ToDur>(__tp.time_since_epoch())};
952 template<
typename _ToDur,
typename _Clock,
typename _Dur>
954 enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>
955 ceil(
const time_point<_Clock, _Dur>& __tp)
957 return time_point<_Clock, _ToDur>{
958 chrono::ceil<_ToDur>(__tp.time_since_epoch())};
961 template<
typename _ToDur,
typename _Clock,
typename _Dur>
963 __and_<__is_duration<_ToDur>,
964 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
965 time_point<_Clock, _ToDur>>
966 round(
const time_point<_Clock, _Dur>& __tp)
968 return time_point<_Clock, _ToDur>{
969 chrono::round<_ToDur>(__tp.time_since_epoch())};
976 template<
typename _Clock,
typename _Dur1,
977 typename _Rep2,
typename _Period2>
978 constexpr time_point<_Clock,
979 typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
981 const duration<_Rep2, _Period2>& __rhs)
983 typedef duration<_Rep2, _Period2> __dur2;
986 return __time_point(__lhs.time_since_epoch() + __rhs);
990 template<
typename _Rep1,
typename _Period1,
991 typename _Clock,
typename _Dur2>
997 typedef duration<_Rep1, _Period1> __dur1;
1000 return __time_point(__rhs.time_since_epoch() + __lhs);
1004 template<
typename _Clock,
typename _Dur1,
1005 typename _Rep2,
typename _Period2>
1009 const duration<_Rep2, _Period2>& __rhs)
1011 typedef duration<_Rep2, _Period2> __dur2;
1014 return __time_point(__lhs.time_since_epoch() -__rhs);
1022 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1026 {
return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
1028 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1032 {
return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
1034 #if __cpp_lib_three_way_comparison
1035 template<
typename _Clock,
typename _Dur1,
1036 three_way_comparable_with<_Dur1> _Dur2>
1038 operator<=>(
const time_point<_Clock, _Dur1>& __lhs,
1039 const time_point<_Clock, _Dur2>& __rhs)
1040 {
return __lhs.time_since_epoch() <=> __rhs.time_since_epoch(); }
1042 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1044 operator!=(
const time_point<_Clock, _Dur1>& __lhs,
1045 const time_point<_Clock, _Dur2>& __rhs)
1046 {
return !(__lhs == __rhs); }
1049 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1051 operator<(
const time_point<_Clock, _Dur1>& __lhs,
1052 const time_point<_Clock, _Dur2>& __rhs)
1053 {
return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
1055 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1057 operator<=(
const time_point<_Clock, _Dur1>& __lhs,
1058 const time_point<_Clock, _Dur2>& __rhs)
1059 {
return !(__rhs < __lhs); }
1061 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1063 operator>(
const time_point<_Clock, _Dur1>& __lhs,
1064 const time_point<_Clock, _Dur2>& __rhs)
1065 {
return __rhs < __lhs; }
1067 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1069 operator>=(
const time_point<_Clock, _Dur1>& __lhs,
1070 const time_point<_Clock, _Dur2>& __rhs)
1071 {
return !(__lhs < __rhs); }
1093 inline namespace _V2 {
1104 typedef duration::rep rep;
1105 typedef duration::period period;
1108 static_assert(system_clock::duration::min()
1109 < system_clock::duration::zero(),
1110 "a clock's minimum duration cannot be less than its epoch");
1112 static constexpr
bool is_steady =
false;
1121 return std::time_t(duration_cast<chrono::seconds>
1122 (__t.time_since_epoch()).count());
1126 from_time_t(std::time_t __t) noexcept
1129 return time_point_cast<system_clock::duration>
1144 typedef duration::rep rep;
1145 typedef duration::period period;
1148 static constexpr
bool is_steady =
true;
1167 #if __cplusplus > 201703L
1168 template<
typename _Duration>
1170 using sys_seconds = sys_time<seconds>;
1171 using sys_days = sys_time<days>;
1173 using file_clock = ::std::filesystem::__file_clock;
1175 template<
typename _Duration>
1179 template<>
struct is_clock<steady_clock> :
true_type { };
1180 template<>
struct is_clock<file_clock> :
true_type { };
1182 template<>
inline constexpr
bool is_clock_v<system_clock> =
true;
1183 template<>
inline constexpr
bool is_clock_v<steady_clock> =
true;
1184 template<>
inline constexpr
bool is_clock_v<file_clock> =
true;
1187 template<
typename _Duration>
1188 using local_time = time_point<local_t, _Duration>;
1189 using local_seconds = local_time<seconds>;
1190 using local_days = local_time<days>;
1196 template<
typename _Duration>
1197 using utc_time = time_point<utc_clock, _Duration>;
1198 using utc_seconds = utc_time<seconds>;
1200 template<
typename _Duration>
1201 using tai_time = time_point<tai_clock, _Duration>;
1202 using tai_seconds = tai_time<seconds>;
1204 template<
typename _Duration>
1205 using gps_time = time_point<gps_clock, _Duration>;
1206 using gps_seconds = gps_time<seconds>;
1208 template<>
struct is_clock<utc_clock> :
true_type { };
1209 template<>
struct is_clock<tai_clock> :
true_type { };
1210 template<>
struct is_clock<gps_clock> :
true_type { };
1212 template<>
inline constexpr
bool is_clock_v<utc_clock> =
true;
1213 template<>
inline constexpr
bool is_clock_v<tai_clock> =
true;
1214 template<>
inline constexpr
bool is_clock_v<gps_clock> =
true;
1216 struct leap_second_info
1218 bool is_leap_second;
1229 class weekday_indexed;
1232 class month_day_last;
1233 class month_weekday;
1234 class month_weekday_last;
1236 class year_month_day;
1237 class year_month_day_last;
1238 class year_month_weekday;
1239 class year_month_weekday_last;
1243 explicit last_spec() =
default;
1245 friend constexpr month_day_last
1248 friend constexpr month_day_last
1252 inline constexpr last_spec last{};
1262 __modulo(
long long __n,
unsigned __d)
1267 return (__d + (__n % __d)) % __d;
1270 inline constexpr
unsigned __days_per_month[12]
1271 = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
1273 inline constexpr
unsigned __last_day[12]
1274 = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
1288 day(
unsigned __d) noexcept
1293 operator++() noexcept
1300 operator++(
int) noexcept
1308 operator--() noexcept
1315 operator--(
int) noexcept
1323 operator+=(
const days& __d) noexcept
1325 *
this = *
this + __d;
1330 operator-=(
const days& __d) noexcept
1332 *
this = *
this - __d;
1337 operator unsigned() const noexcept
1342 {
return 1 <= _M_d && _M_d <= 31; }
1344 friend constexpr
bool
1345 operator==(
const day& __x,
const day& __y) noexcept
1346 {
return unsigned{__x} ==
unsigned{__y}; }
1348 friend constexpr strong_ordering
1349 operator<=>(
const day& __x,
const day& __y) noexcept
1350 {
return unsigned{__x} <=>
unsigned{__y}; }
1352 friend constexpr day
1353 operator+(
const day& __x,
const days& __y) noexcept
1354 {
return day(
unsigned{__x} + __y.count()); }
1356 friend constexpr day
1357 operator+(
const days& __x,
const day& __y) noexcept
1358 {
return __y + __x; }
1360 friend constexpr day
1361 operator-(
const day& __x,
const days& __y) noexcept
1362 {
return __x + -__y; }
1364 friend constexpr days
1365 operator-(
const day& __x,
const day& __y) noexcept
1366 {
return days{int(
unsigned{__x}) -
int(
unsigned{__y})}; }
1368 friend constexpr month_day
1369 operator/(
const month& __m,
const day& __d) noexcept;
1371 friend constexpr month_day
1372 operator/(
int __m,
const day& __d) noexcept;
1374 friend constexpr month_day
1375 operator/(
const day& __d,
const month& __m) noexcept;
1377 friend constexpr month_day
1378 operator/(
const day& __d,
int __m) noexcept;
1380 friend constexpr year_month_day
1381 operator/(
const year_month& __ym,
const day& __d) noexcept;
1397 month(
unsigned __m) noexcept
1402 operator++() noexcept
1409 operator++(
int) noexcept
1417 operator--() noexcept
1424 operator--(
int) noexcept
1432 operator+=(
const months& __m) noexcept
1434 *
this = *
this + __m;
1439 operator-=(
const months& __m) noexcept
1441 *
this = *
this - __m;
1446 operator unsigned() const noexcept
1451 {
return 1 <= _M_m && _M_m <= 12; }
1453 friend constexpr
bool
1454 operator==(
const month& __x,
const month& __y) noexcept
1455 {
return unsigned{__x} ==
unsigned{__y}; }
1457 friend constexpr strong_ordering
1458 operator<=>(
const month& __x,
const month& __y) noexcept
1459 {
return unsigned{__x} <=>
unsigned{__y}; }
1461 friend constexpr month
1462 operator+(
const month& __x,
const months& __y) noexcept
1464 auto __n =
static_cast<long long>(
unsigned{__x}) + (__y.count() - 1);
1465 return month{__detail::__modulo(__n, 12) + 1};
1468 friend constexpr month
1469 operator+(
const months& __x,
const month& __y) noexcept
1470 {
return __y + __x; }
1472 friend constexpr month
1473 operator-(
const month& __x,
const months& __y) noexcept
1474 {
return __x + -__y; }
1476 friend constexpr months
1477 operator-(
const month& __x,
const month& __y) noexcept
1479 const auto __dm = int(
unsigned(__x)) - int(
unsigned(__y));
1480 return months{__dm < 0 ? 12 + __dm : __dm};
1483 friend constexpr year_month
1484 operator/(
const year& __y,
const month& __m) noexcept;
1486 friend constexpr month_day
1487 operator/(
const month& __m,
int __d) noexcept;
1489 friend constexpr month_day_last
1490 operator/(
const month& __m, last_spec) noexcept;
1492 friend constexpr month_day_last
1493 operator/(last_spec,
const month& __m) noexcept;
1495 friend constexpr month_weekday
1496 operator/(
const month& __m,
const weekday_indexed& __wdi) noexcept;
1498 friend constexpr month_weekday
1499 operator/(
const weekday_indexed& __wdi,
const month& __m) noexcept;
1501 friend constexpr month_weekday_last
1502 operator/(
const month& __m,
const weekday_last& __wdl) noexcept;
1504 friend constexpr month_weekday_last
1505 operator/(
const weekday_last& __wdl,
const month& __m) noexcept;
1510 inline constexpr month January{1};
1511 inline constexpr month February{2};
1512 inline constexpr month March{3};
1513 inline constexpr month April{4};
1514 inline constexpr month May{5};
1515 inline constexpr month June{6};
1516 inline constexpr month July{7};
1517 inline constexpr month August{8};
1518 inline constexpr month September{9};
1519 inline constexpr month October{10};
1520 inline constexpr month November{11};
1521 inline constexpr month December{12};
1534 year(
int __y) noexcept
1535 : _M_y{
static_cast<short>(__y)}
1538 static constexpr year
1540 {
return year{-32767}; }
1542 static constexpr year
1544 {
return year{32767}; }
1547 operator++() noexcept
1554 operator++(
int) noexcept
1562 operator--() noexcept
1569 operator--(
int) noexcept
1577 operator+=(
const years& __y) noexcept
1579 *
this = *
this + __y;
1584 operator-=(
const years& __y) noexcept
1586 *
this = *
this - __y;
1596 {
return year{-_M_y}; }
1599 is_leap() const noexcept
1600 {
return _M_y % 4 == 0 && (_M_y % 100 != 0 || _M_y % 400 == 0); }
1603 operator int() const noexcept
1608 {
return min()._M_y <= _M_y && _M_y <=
max()._M_y; }
1610 friend constexpr
bool
1611 operator==(
const year& __x,
const year& __y) noexcept
1612 {
return int{__x} ==
int{__y}; }
1614 friend constexpr strong_ordering
1615 operator<=>(
const year& __x,
const year& __y) noexcept
1616 {
return int{__x} <=>
int{__y}; }
1618 friend constexpr year
1619 operator+(
const year& __x,
const years& __y) noexcept
1620 {
return year{
int{__x} +
static_cast<int>(__y.count())}; }
1622 friend constexpr year
1623 operator+(
const years& __x,
const year& __y) noexcept
1624 {
return __y + __x; }
1626 friend constexpr year
1627 operator-(
const year& __x,
const years& __y) noexcept
1628 {
return __x + -__y; }
1630 friend constexpr years
1631 operator-(
const year& __x,
const year& __y) noexcept
1632 {
return years{
int{__x} -
int{__y}}; }
1634 friend constexpr year_month
1635 operator/(
const year& __y,
int __m) noexcept;
1637 friend constexpr year_month_day
1638 operator/(
const year& __y,
const month_day& __md) noexcept;
1640 friend constexpr year_month_day
1641 operator/(
const month_day& __md,
const year& __y) noexcept;
1643 friend constexpr year_month_day_last
1644 operator/(
const year& __y,
const month_day_last& __mdl) noexcept;
1646 friend constexpr year_month_day_last
1647 operator/(
const month_day_last& __mdl,
const year& __y) noexcept;
1649 friend constexpr year_month_weekday
1650 operator/(
const year& __y,
const month_weekday& __mwd) noexcept;
1652 friend constexpr year_month_weekday
1653 operator/(
const month_weekday& __mwd,
const year& __y) noexcept;
1655 friend constexpr year_month_weekday_last
1656 operator/(
const year& __y,
const month_weekday_last& __mwdl) noexcept;
1658 friend constexpr year_month_weekday_last
1659 operator/(
const month_weekday_last& __mwdl,
const year& __y) noexcept;
1669 unsigned char _M_wd;
1671 static constexpr weekday
1672 _S_from_days(
const days& __d)
1674 auto __n = __d.count();
1675 return weekday(__n >= -4 ? (__n + 4) % 7 : (__n + 5) % 7 + 6);
1679 weekday() =
default;
1682 weekday(
unsigned __wd) noexcept
1683 : _M_wd(__wd == 7 ? 0 : __wd)
1687 weekday(
const sys_days& __dp) noexcept
1688 : weekday{_S_from_days(__dp.time_since_epoch())}
1692 weekday(
const local_days& __dp) noexcept
1693 : weekday{sys_days{__dp.time_since_epoch()}}
1697 operator++() noexcept
1704 operator++(
int) noexcept
1712 operator--() noexcept
1719 operator--(
int) noexcept
1727 operator+=(
const days& __d) noexcept
1729 *
this = *
this + __d;
1734 operator-=(
const days& __d) noexcept
1736 *
this = *
this - __d;
1741 c_encoding() const noexcept
1745 iso_encoding() const noexcept
1746 {
return _M_wd == 0u ? 7u : _M_wd; }
1750 {
return _M_wd <= 6; }
1752 constexpr weekday_indexed
1753 operator[](
unsigned __index)
const noexcept;
1755 constexpr weekday_last
1756 operator[](last_spec)
const noexcept;
1758 friend constexpr
bool
1759 operator==(
const weekday& __x,
const weekday& __y) noexcept
1760 {
return __x._M_wd == __y._M_wd; }
1762 friend constexpr weekday
1763 operator+(
const weekday& __x,
const days& __y) noexcept
1765 auto __n =
static_cast<long long>(__x._M_wd) + __y.count();
1766 return weekday{__detail::__modulo(__n, 7)};
1769 friend constexpr weekday
1770 operator+(
const days& __x,
const weekday& __y) noexcept
1771 {
return __y + __x; }
1773 friend constexpr weekday
1774 operator-(
const weekday& __x,
const days& __y) noexcept
1775 {
return __x + -__y; }
1777 friend constexpr days
1778 operator-(
const weekday& __x,
const weekday& __y) noexcept
1780 auto __n =
static_cast<long long>(__x._M_wd) - __y._M_wd;
1781 return days{__detail::__modulo(__n, 7)};
1787 inline constexpr weekday Sunday{0};
1788 inline constexpr weekday Monday{1};
1789 inline constexpr weekday Tuesday{2};
1790 inline constexpr weekday Wednesday{3};
1791 inline constexpr weekday Thursday{4};
1792 inline constexpr weekday Friday{5};
1793 inline constexpr weekday Saturday{6};
1797 class weekday_indexed
1800 chrono::weekday _M_wd;
1801 unsigned char _M_index;
1804 weekday_indexed() =
default;
1807 weekday_indexed(
const chrono::weekday& __wd,
unsigned __index) noexcept
1808 : _M_wd(__wd), _M_index(__index)
1811 constexpr chrono::weekday
1812 weekday() const noexcept
1816 index() const noexcept
1817 {
return _M_index; };
1821 {
return _M_wd.ok() && 1 <= _M_index && _M_index <= 5; }
1823 friend constexpr
bool
1824 operator==(
const weekday_indexed& __x,
const weekday_indexed& __y) noexcept
1825 {
return __x.weekday() == __y.weekday() && __x.index() == __y.index(); }
1827 friend constexpr month_weekday
1828 operator/(
const month& __m,
const weekday_indexed& __wdi) noexcept;
1830 friend constexpr month_weekday
1831 operator/(
int __m,
const weekday_indexed& __wdi) noexcept;
1833 friend constexpr month_weekday
1834 operator/(
const weekday_indexed& __wdi,
const month& __m) noexcept;
1836 friend constexpr month_weekday
1837 operator/(
const weekday_indexed& __wdi,
int __m) noexcept;
1839 friend constexpr year_month_weekday
1840 operator/(
const year_month& __ym,
const weekday_indexed& __wdi) noexcept;
1845 constexpr weekday_indexed
1846 weekday::operator[](
unsigned __index)
const noexcept
1847 {
return {*
this, __index}; }
1854 chrono::weekday _M_wd;
1858 weekday_last(
const chrono::weekday& __wd) noexcept
1862 constexpr chrono::weekday
1863 weekday() const noexcept
1868 {
return _M_wd.ok(); }
1870 friend constexpr
bool
1871 operator==(
const weekday_last& __x,
const weekday_last& __y) noexcept
1872 {
return __x.weekday() == __y.weekday(); }
1874 friend constexpr month_weekday_last
1875 operator/(
int __m,
const weekday_last& __wdl) noexcept;
1877 friend constexpr month_weekday_last
1878 operator/(
const weekday_last& __wdl,
int __m) noexcept;
1880 friend constexpr year_month_weekday_last
1881 operator/(
const year_month& __ym,
const weekday_last& __wdl) noexcept;
1886 constexpr weekday_last
1887 weekday::operator[](last_spec)
const noexcept
1888 {
return weekday_last{*
this}; }
1899 month_day() =
default;
1902 month_day(
const chrono::month& __m,
const chrono::day& __d) noexcept
1903 : _M_m{__m}, _M_d{__d}
1906 constexpr chrono::month
1907 month() const noexcept
1910 constexpr chrono::day
1911 day() const noexcept
1918 && 1u <= unsigned(_M_d)
1919 && unsigned(_M_d) <= __detail::__days_per_month[unsigned(_M_m) - 1];
1922 friend constexpr
bool
1923 operator==(
const month_day& __x,
const month_day& __y) noexcept
1924 {
return __x.month() == __y.month() && __x.day() == __y.day(); }
1926 friend constexpr strong_ordering
1927 operator<=>(
const month_day& __x,
const month_day& __y) noexcept
1930 friend constexpr month_day
1931 operator/(
const chrono::month& __m,
const chrono::day& __d) noexcept
1932 {
return {__m, __d}; }
1934 friend constexpr month_day
1935 operator/(
const chrono::month& __m,
int __d) noexcept
1936 {
return {__m, chrono::day(
unsigned(__d))}; }
1938 friend constexpr month_day
1939 operator/(
int __m,
const chrono::day& __d) noexcept
1940 {
return {chrono::month(
unsigned(__m)), __d}; }
1942 friend constexpr month_day
1943 operator/(
const chrono::day& __d,
const chrono::month& __m) noexcept
1944 {
return {__m, __d}; }
1946 friend constexpr month_day
1947 operator/(
const chrono::day& __d,
int __m) noexcept
1948 {
return {chrono::month(
unsigned(__m)), __d}; }
1950 friend constexpr year_month_day
1951 operator/(
int __y,
const month_day& __md) noexcept;
1953 friend constexpr year_month_day
1954 operator/(
const month_day& __md,
int __y) noexcept;
1961 class month_day_last
1968 month_day_last(
const chrono::month& __m) noexcept
1972 constexpr chrono::month
1973 month() const noexcept
1978 {
return _M_m.ok(); }
1980 friend constexpr
bool
1981 operator==(
const month_day_last& __x,
const month_day_last& __y) noexcept
1982 {
return __x.month() == __y.month(); }
1984 friend constexpr strong_ordering
1985 operator<=>(
const month_day_last& __x,
const month_day_last& __y) noexcept
1988 friend constexpr month_day_last
1989 operator/(
const chrono::month& __m, last_spec) noexcept
1990 {
return month_day_last{__m}; }
1992 friend constexpr month_day_last
1994 {
return chrono::month(
unsigned(__m)) / last; }
1996 friend constexpr month_day_last
1997 operator/(last_spec,
const chrono::month& __m) noexcept
1998 {
return __m / last; }
2000 friend constexpr month_day_last
2002 {
return __m / last; }
2004 friend constexpr year_month_day_last
2005 operator/(
int __y,
const month_day_last& __mdl) noexcept;
2007 friend constexpr year_month_day_last
2008 operator/(
const month_day_last& __mdl,
int __y) noexcept;
2019 chrono::weekday_indexed _M_wdi;
2023 month_weekday(
const chrono::month& __m,
2024 const chrono::weekday_indexed& __wdi) noexcept
2025 : _M_m{__m}, _M_wdi{__wdi}
2028 constexpr chrono::month
2029 month() const noexcept
2032 constexpr chrono::weekday_indexed
2033 weekday_indexed() const noexcept
2038 {
return _M_m.ok() && _M_wdi.ok(); }
2040 friend constexpr
bool
2041 operator==(
const month_weekday& __x,
const month_weekday& __y) noexcept
2043 return __x.month() == __y.month()
2044 && __x.weekday_indexed() == __y.weekday_indexed();
2047 friend constexpr month_weekday
2049 const chrono::weekday_indexed& __wdi) noexcept
2050 {
return {__m, __wdi}; }
2052 friend constexpr month_weekday
2053 operator/(
int __m,
const chrono::weekday_indexed& __wdi) noexcept
2054 {
return chrono::month(
unsigned(__m)) / __wdi; }
2056 friend constexpr month_weekday
2057 operator/(
const chrono::weekday_indexed& __wdi,
2058 const chrono::month& __m) noexcept
2059 {
return __m / __wdi; }
2061 friend constexpr month_weekday
2062 operator/(
const chrono::weekday_indexed& __wdi,
int __m) noexcept
2063 {
return __m / __wdi; }
2065 friend constexpr year_month_weekday
2066 operator/(
int __y,
const month_weekday& __mwd) noexcept;
2068 friend constexpr year_month_weekday
2069 operator/(
const month_weekday& __mwd,
int __y) noexcept;
2076 class month_weekday_last
2080 chrono::weekday_last _M_wdl;
2084 month_weekday_last(
const chrono::month& __m,
2085 const chrono::weekday_last& __wdl) noexcept
2086 :_M_m{__m}, _M_wdl{__wdl}
2089 constexpr chrono::month
2090 month() const noexcept
2093 constexpr chrono::weekday_last
2094 weekday_last() const noexcept
2099 {
return _M_m.ok() && _M_wdl.ok(); }
2101 friend constexpr
bool
2102 operator==(
const month_weekday_last& __x,
2103 const month_weekday_last& __y) noexcept
2105 return __x.month() == __y.month()
2106 && __x.weekday_last() == __y.weekday_last();
2109 friend constexpr month_weekday_last
2111 const chrono::weekday_last& __wdl) noexcept
2112 {
return {__m, __wdl}; }
2114 friend constexpr month_weekday_last
2115 operator/(
int __m,
const chrono::weekday_last& __wdl) noexcept
2116 {
return chrono::month(
unsigned(__m)) / __wdl; }
2118 friend constexpr month_weekday_last
2119 operator/(
const chrono::weekday_last& __wdl,
2120 const chrono::month& __m) noexcept
2121 {
return __m / __wdl; }
2123 friend constexpr month_weekday_last
2124 operator/(
const chrono::weekday_last& __wdl,
int __m) noexcept
2125 {
return chrono::month(
unsigned(__m)) / __wdl; }
2127 friend constexpr year_month_weekday_last
2128 operator/(
int __y,
const month_weekday_last& __mwdl) noexcept;
2130 friend constexpr year_month_weekday_last
2131 operator/(
const month_weekday_last& __mwdl,
int __y) noexcept;
2152 using __months_years_conversion_disambiguator = void;
2162 year_month() =
default;
2165 year_month(
const chrono::year& __y,
const chrono::month& __m) noexcept
2166 : _M_y{__y}, _M_m{__m}
2169 constexpr chrono::year
2170 year() const noexcept
2173 constexpr chrono::month
2174 month() const noexcept
2177 template<
typename = __detail::__months_years_conversion_disambiguator>
2178 constexpr year_month&
2179 operator+=(
const months& __dm) noexcept
2181 *
this = *
this + __dm;
2185 template<
typename = __detail::__months_years_conversion_disambiguator>
2186 constexpr year_month&
2187 operator-=(
const months& __dm) noexcept
2189 *
this = *
this - __dm;
2193 constexpr year_month&
2194 operator+=(
const years& __dy) noexcept
2196 *
this = *
this + __dy;
2200 constexpr year_month&
2201 operator-=(
const years& __dy) noexcept
2203 *
this = *
this - __dy;
2209 {
return _M_y.ok() && _M_m.ok(); }
2211 friend constexpr
bool
2212 operator==(
const year_month& __x,
const year_month& __y) noexcept
2213 {
return __x.year() == __y.year() && __x.month() == __y.month(); }
2215 friend constexpr strong_ordering
2216 operator<=>(
const year_month& __x,
const year_month& __y) noexcept
2219 template<
typename = __detail::__months_years_conversion_disambiguator>
2220 friend constexpr year_month
2221 operator+(
const year_month& __ym,
const months& __dm) noexcept
2224 auto __m = __ym.month() + __dm;
2225 auto __i = int(
unsigned(__ym.month())) - 1 + __dm.count();
2227 ? __ym.year() + years{(__i - 11) / 12}
2228 : __ym.year() + years{__i / 12});
2232 template<
typename = __detail::__months_years_conversion_disambiguator>
2233 friend constexpr year_month
2234 operator+(
const months& __dm,
const year_month& __ym) noexcept
2235 {
return __ym + __dm; }
2237 template<
typename = __detail::__months_years_conversion_disambiguator>
2238 friend constexpr year_month
2239 operator-(
const year_month& __ym,
const months& __dm) noexcept
2240 {
return __ym + -__dm; }
2242 friend constexpr months
2243 operator-(
const year_month& __x,
const year_month& __y) noexcept
2245 return (__x.year() - __y.year()
2246 + months{static_cast<int>(unsigned{__x.month()})
2247 -
static_cast<int>(
unsigned{__y.month()})});
2250 friend constexpr year_month
2251 operator+(
const year_month& __ym,
const years& __dy) noexcept
2252 {
return (__ym.year() + __dy) / __ym.month(); }
2254 friend constexpr year_month
2255 operator+(
const years& __dy,
const year_month& __ym) noexcept
2256 {
return __ym + __dy; }
2258 friend constexpr year_month
2259 operator-(
const year_month& __ym,
const years& __dy) noexcept
2260 {
return __ym + -__dy; }
2262 friend constexpr year_month
2263 operator/(
const chrono::year& __y,
const chrono::month& __m) noexcept
2264 {
return {__y, __m}; }
2266 friend constexpr year_month
2267 operator/(
const chrono::year& __y,
int __m) noexcept
2268 {
return {__y, chrono::month(
unsigned(__m))}; }
2270 friend constexpr year_month_day
2271 operator/(
const year_month& __ym,
int __d) noexcept;
2273 friend constexpr year_month_day_last
2274 operator/(
const year_month& __ym, last_spec) noexcept;
2281 class year_month_day
2288 static constexpr year_month_day _S_from_days(
const days& __dp) noexcept;
2290 constexpr days _M_days_since_epoch() const noexcept;
2293 year_month_day() = default;
2296 year_month_day(const chrono::year& __y, const chrono::month& __m,
2297 const chrono::day& __d) noexcept
2298 : _M_y{__y}, _M_m{__m}, _M_d{__d}
2302 year_month_day(
const year_month_day_last& __ymdl) noexcept;
2305 year_month_day(
const sys_days& __dp) noexcept
2306 : year_month_day(_S_from_days(__dp.time_since_epoch()))
2310 year_month_day(
const local_days& __dp) noexcept
2311 : year_month_day(sys_days{__dp.time_since_epoch()})
2314 template<
typename = __detail::__months_years_conversion_disambiguator>
2315 constexpr year_month_day&
2316 operator+=(
const months& __m) noexcept
2318 *
this = *
this + __m;
2322 template<
typename = __detail::__months_years_conversion_disambiguator>
2323 constexpr year_month_day&
2324 operator-=(
const months& __m) noexcept
2326 *
this = *
this - __m;
2330 constexpr year_month_day&
2331 operator+=(
const years& __y) noexcept
2333 *
this = *
this + __y;
2337 constexpr year_month_day&
2338 operator-=(
const years& __y) noexcept
2340 *
this = *
this - __y;
2344 constexpr chrono::year
2345 year() const noexcept
2348 constexpr chrono::month
2349 month() const noexcept
2352 constexpr chrono::day
2353 day() const noexcept
2357 operator sys_days() const noexcept
2358 {
return sys_days{_M_days_since_epoch()}; }
2361 operator local_days() const noexcept
2362 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2364 constexpr
bool ok() const noexcept;
2366 friend constexpr
bool
2367 operator==(const year_month_day& __x, const year_month_day& __y) noexcept
2369 return __x.year() == __y.year()
2370 && __x.month() == __y.month()
2371 && __x.day() == __y.day();
2374 friend constexpr strong_ordering
2375 operator<=>(
const year_month_day& __x,
const year_month_day& __y) noexcept
2378 template<
typename = __detail::__months_years_conversion_disambiguator>
2379 friend constexpr year_month_day
2380 operator+(
const year_month_day& __ymd,
const months& __dm) noexcept
2381 {
return (__ymd.year() / __ymd.month() + __dm) / __ymd.day(); }
2383 template<
typename = __detail::__months_years_conversion_disambiguator>
2384 friend constexpr year_month_day
2385 operator+(
const months& __dm,
const year_month_day& __ymd) noexcept
2386 {
return __ymd + __dm; }
2388 friend constexpr year_month_day
2389 operator+(
const year_month_day& __ymd,
const years& __dy) noexcept
2390 {
return (__ymd.year() + __dy) / __ymd.month() / __ymd.day(); }
2392 friend constexpr year_month_day
2393 operator+(
const years& __dy,
const year_month_day& __ymd) noexcept
2394 {
return __ymd + __dy; }
2396 template<
typename = __detail::__months_years_conversion_disambiguator>
2397 friend constexpr year_month_day
2398 operator-(
const year_month_day& __ymd,
const months& __dm) noexcept
2399 {
return __ymd + -__dm; }
2401 friend constexpr year_month_day
2402 operator-(
const year_month_day& __ymd,
const years& __dy) noexcept
2403 {
return __ymd + -__dy; }
2405 friend constexpr year_month_day
2406 operator/(
const year_month& __ym,
const chrono::day& __d) noexcept
2407 {
return {__ym.year(), __ym.month(), __d}; }
2409 friend constexpr year_month_day
2410 operator/(
const year_month& __ym,
int __d) noexcept
2411 {
return __ym / chrono::day{unsigned(__d)}; }
2413 friend constexpr year_month_day
2414 operator/(
const chrono::year& __y,
const month_day& __md) noexcept
2415 {
return __y / __md.month() / __md.day(); }
2417 friend constexpr year_month_day
2418 operator/(
int __y,
const month_day& __md) noexcept
2419 {
return chrono::year{__y} / __md; }
2421 friend constexpr year_month_day
2422 operator/(
const month_day& __md,
const chrono::year& __y) noexcept
2423 {
return __y / __md; }
2425 friend constexpr year_month_day
2426 operator/(
const month_day& __md,
int __y) noexcept
2427 {
return chrono::year(__y) / __md; }
2433 constexpr year_month_day
2434 year_month_day::_S_from_days(
const days& __dp) noexcept
2436 const auto __z = __dp.count() + 719468;
2437 const auto __era = (__z >= 0 ? __z : __z - 146096) / 146097;
2438 const auto __doe =
static_cast<unsigned>(__z - __era * 146097);
2440 = (__doe - __doe / 1460 + __doe / 36524 - __doe / 146096) / 365;
2441 const auto __y =
static_cast<days::rep
>(__yoe) + __era * 400;
2442 const auto __doy = __doe - (365 * __yoe + __yoe / 4 - __yoe / 100);
2443 const auto __mp = (5 * __doy + 2) / 153;
2444 const auto __d = __doy - (153 * __mp + 2) / 5 + 1;
2445 const auto __m = __mp < 10 ? __mp + 3 : __mp - 9;
2446 return year_month_day{chrono::year(__y + (__m <= 2)),
2447 chrono::month(__m), chrono::day(__d)};
2452 year_month_day::_M_days_since_epoch() const noexcept
2454 const auto __y =
static_cast<int>(_M_y) - (_M_m <= February);
2455 const auto __m =
static_cast<unsigned>(_M_m);
2456 const auto __d =
static_cast<unsigned>(_M_d);
2457 const auto __era = (__y >= 0 ? __y : __y - 399) / 400;
2459 const auto __yoe =
static_cast<unsigned>(__y - __era * 400);
2461 const auto __doy = (153 * (__m > 2 ? __m - 3 : __m + 9) + 2) / 5 + __d - 1;
2463 const auto __doe = __yoe * 365 + __yoe / 4 - __yoe / 100 + __doy;
2464 const auto __days = __era * 146097 +
static_cast<int>(__doe) - 719468;
2465 return days{__days};
2470 class year_month_day_last
2474 chrono::month_day_last _M_mdl;
2478 year_month_day_last(
const chrono::year& __y,
2479 const chrono::month_day_last& __mdl) noexcept
2480 : _M_y{__y}, _M_mdl{__mdl}
2483 template<
typename = __detail::__months_years_conversion_disambiguator>
2484 constexpr year_month_day_last&
2485 operator+=(
const months& __m) noexcept
2487 *
this = *
this + __m;
2491 template<
typename = __detail::__months_years_conversion_disambiguator>
2492 constexpr year_month_day_last&
2493 operator-=(
const months& __m) noexcept
2495 *
this = *
this - __m;
2499 constexpr year_month_day_last&
2500 operator+=(
const years& __y) noexcept
2502 *
this = *
this + __y;
2506 constexpr year_month_day_last&
2507 operator-=(
const years& __y) noexcept
2509 *
this = *
this - __y;
2513 constexpr chrono::year
2514 year() const noexcept
2517 constexpr chrono::month
2518 month() const noexcept
2519 {
return _M_mdl.month(); }
2521 constexpr chrono::month_day_last
2522 month_day_last() const noexcept
2526 constexpr chrono::day
2527 day() const noexcept
2529 if (!_M_mdl.ok() || (month() == February && _M_y.is_leap()))
2530 return chrono::day{29};
2531 return chrono::day{__detail::__last_day[unsigned(month()) - 1]};
2535 operator sys_days() const noexcept
2536 {
return sys_days{year() / month() / day()}; }
2539 operator local_days() const noexcept
2540 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2544 {
return _M_y.ok() && _M_mdl.ok(); }
2546 friend constexpr
bool
2547 operator==(
const year_month_day_last& __x,
2548 const year_month_day_last& __y) noexcept
2550 return __x.year() == __y.year()
2551 && __x.month_day_last() == __y.month_day_last();
2554 friend constexpr strong_ordering
2555 operator<=>(
const year_month_day_last& __x,
2556 const year_month_day_last& __y) noexcept
2559 template<
typename = __detail::__months_years_conversion_disambiguator>
2560 friend constexpr year_month_day_last
2561 operator+(
const year_month_day_last& __ymdl,
2562 const months& __dm) noexcept
2563 {
return (__ymdl.year() / __ymdl.month() + __dm) / last; }
2565 template<
typename = __detail::__months_years_conversion_disambiguator>
2566 friend constexpr year_month_day_last
2568 const year_month_day_last& __ymdl) noexcept
2569 {
return __ymdl + __dm; }
2571 template<
typename = __detail::__months_years_conversion_disambiguator>
2572 friend constexpr year_month_day_last
2573 operator-(
const year_month_day_last& __ymdl,
2574 const months& __dm) noexcept
2575 {
return __ymdl + -__dm; }
2577 friend constexpr year_month_day_last
2578 operator+(
const year_month_day_last& __ymdl,
2579 const years& __dy) noexcept
2580 {
return {__ymdl.year() + __dy, __ymdl.month_day_last()}; }
2582 friend constexpr year_month_day_last
2584 const year_month_day_last& __ymdl) noexcept
2585 {
return __ymdl + __dy; }
2587 friend constexpr year_month_day_last
2588 operator-(
const year_month_day_last& __ymdl,
2589 const years& __dy) noexcept
2590 {
return __ymdl + -__dy; }
2592 friend constexpr year_month_day_last
2593 operator/(
const year_month& __ym, last_spec) noexcept
2594 {
return {__ym.year(), chrono::month_day_last{__ym.month()}}; }
2596 friend constexpr year_month_day_last
2598 const chrono::month_day_last& __mdl) noexcept
2599 {
return {__y, __mdl}; }
2601 friend constexpr year_month_day_last
2602 operator/(
int __y,
const chrono::month_day_last& __mdl) noexcept
2603 {
return chrono::year(__y) / __mdl; }
2605 friend constexpr year_month_day_last
2606 operator/(
const chrono::month_day_last& __mdl,
2607 const chrono::year& __y) noexcept
2608 {
return __y / __mdl; }
2610 friend constexpr year_month_day_last
2611 operator/(
const chrono::month_day_last& __mdl,
int __y) noexcept
2612 {
return chrono::year(__y) / __mdl; }
2619 year_month_day::year_month_day(
const year_month_day_last& __ymdl) noexcept
2620 : _M_y{__ymdl.year()}, _M_m{__ymdl.month()}, _M_d{__ymdl.day()}
2624 year_month_day::ok() const noexcept
2626 if (!_M_y.ok() || !_M_m.ok())
2628 return chrono::day{1} <= _M_d && _M_d <= (_M_y / _M_m / last).day();
2633 class year_month_weekday
2638 chrono::weekday_indexed _M_wdi;
2640 static constexpr year_month_weekday
2641 _S_from_sys_days(
const sys_days& __dp)
2643 year_month_day __ymd{__dp};
2644 chrono::weekday __wd{__dp};
2645 auto __index = __wd[(
unsigned{__ymd.day()} - 1) / 7 + 1];
2646 return {__ymd.year(), __ymd.month(), __index};
2650 year_month_weekday() =
default;
2653 year_month_weekday(
const chrono::year& __y,
const chrono::month& __m,
2654 const chrono::weekday_indexed& __wdi) noexcept
2655 : _M_y{__y}, _M_m{__m}, _M_wdi{__wdi}
2659 year_month_weekday(
const sys_days& __dp) noexcept
2660 : year_month_weekday{_S_from_sys_days(__dp)}
2664 year_month_weekday(
const local_days& __dp) noexcept
2665 : year_month_weekday{sys_days{__dp.time_since_epoch()}}
2668 template<
typename = __detail::__months_years_conversion_disambiguator>
2669 constexpr year_month_weekday&
2670 operator+=(
const months& __m) noexcept
2672 *
this = *
this + __m;
2676 template<
typename = __detail::__months_years_conversion_disambiguator>
2677 constexpr year_month_weekday&
2678 operator-=(
const months& __m) noexcept
2680 *
this = *
this - __m;
2684 constexpr year_month_weekday&
2685 operator+=(
const years& __y) noexcept
2687 *
this = *
this + __y;
2691 constexpr year_month_weekday&
2692 operator-=(
const years& __y) noexcept
2694 *
this = *
this - __y;
2698 constexpr chrono::year
2699 year() const noexcept
2702 constexpr chrono::month
2703 month() const noexcept
2706 constexpr chrono::weekday
2707 weekday() const noexcept
2708 {
return _M_wdi.weekday(); }
2711 index() const noexcept
2712 {
return _M_wdi.index(); }
2714 constexpr chrono::weekday_indexed
2715 weekday_indexed() const noexcept
2719 operator sys_days() const noexcept
2721 auto __d = sys_days{year() / month() / 1};
2722 return __d + (weekday() - chrono::weekday(__d)
2723 + days{(
static_cast<int>(index())-1)*7});
2727 operator local_days() const noexcept
2728 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2733 if (!_M_y.ok() || !_M_m.ok() || !_M_wdi.ok())
2735 if (_M_wdi.index() <= 4)
2737 days __d = (_M_wdi.weekday()
2738 - chrono::weekday{sys_days{_M_y / _M_m / 1}}
2739 + days((_M_wdi.index()-1)*7 + 1));
2740 __glibcxx_assert(__d.count() >= 1);
2741 return __d.count() <=
unsigned{(_M_y / _M_m / last).day()};
2744 friend constexpr
bool
2745 operator==(
const year_month_weekday& __x,
2746 const year_month_weekday& __y) noexcept
2748 return __x.year() == __y.year()
2749 && __x.month() == __y.month()
2750 && __x.weekday_indexed() == __y.weekday_indexed();
2753 template<
typename = __detail::__months_years_conversion_disambiguator>
2754 friend constexpr year_month_weekday
2755 operator+(
const year_month_weekday& __ymwd,
const months& __dm) noexcept
2757 return ((__ymwd.year() / __ymwd.month() + __dm)
2758 / __ymwd.weekday_indexed());
2761 template<
typename = __detail::__months_years_conversion_disambiguator>
2762 friend constexpr year_month_weekday
2763 operator+(
const months& __dm,
const year_month_weekday& __ymwd) noexcept
2764 {
return __ymwd + __dm; }
2766 friend constexpr year_month_weekday
2767 operator+(
const year_month_weekday& __ymwd,
const years& __dy) noexcept
2768 {
return {__ymwd.year() + __dy, __ymwd.month(), __ymwd.weekday_indexed()}; }
2770 friend constexpr year_month_weekday
2771 operator+(
const years& __dy,
const year_month_weekday& __ymwd) noexcept
2772 {
return __ymwd + __dy; }
2774 template<
typename = __detail::__months_years_conversion_disambiguator>
2775 friend constexpr year_month_weekday
2776 operator-(
const year_month_weekday& __ymwd,
const months& __dm) noexcept
2777 {
return __ymwd + -__dm; }
2779 friend constexpr year_month_weekday
2780 operator-(
const year_month_weekday& __ymwd,
const years& __dy) noexcept
2781 {
return __ymwd + -__dy; }
2783 friend constexpr year_month_weekday
2785 const chrono::weekday_indexed& __wdi) noexcept
2786 {
return {__ym.year(), __ym.month(), __wdi}; }
2788 friend constexpr year_month_weekday
2789 operator/(
const chrono::year& __y,
const month_weekday& __mwd) noexcept
2790 {
return {__y, __mwd.month(), __mwd.weekday_indexed()}; }
2792 friend constexpr year_month_weekday
2793 operator/(
int __y,
const month_weekday& __mwd) noexcept
2794 {
return chrono::year(__y) / __mwd; }
2796 friend constexpr year_month_weekday
2797 operator/(
const month_weekday& __mwd,
const chrono::year& __y) noexcept
2798 {
return __y / __mwd; }
2800 friend constexpr year_month_weekday
2801 operator/(
const month_weekday& __mwd,
int __y) noexcept
2802 {
return chrono::year(__y) / __mwd; }
2809 class year_month_weekday_last
2814 chrono::weekday_last _M_wdl;
2818 year_month_weekday_last(
const chrono::year& __y,
const chrono::month& __m,
2819 const chrono::weekday_last& __wdl) noexcept
2820 : _M_y{__y}, _M_m{__m}, _M_wdl{__wdl}
2823 template<
typename = __detail::__months_years_conversion_disambiguator>
2824 constexpr year_month_weekday_last&
2825 operator+=(
const months& __m) noexcept
2827 *
this = *
this + __m;
2831 template<
typename = __detail::__months_years_conversion_disambiguator>
2832 constexpr year_month_weekday_last&
2833 operator-=(
const months& __m) noexcept
2835 *
this = *
this - __m;
2839 constexpr year_month_weekday_last&
2840 operator+=(
const years& __y) noexcept
2842 *
this = *
this + __y;
2846 constexpr year_month_weekday_last&
2847 operator-=(
const years& __y) noexcept
2849 *
this = *
this - __y;
2853 constexpr chrono::year
2854 year() const noexcept
2857 constexpr chrono::month
2858 month() const noexcept
2861 constexpr chrono::weekday
2862 weekday() const noexcept
2863 {
return _M_wdl.weekday(); }
2865 constexpr chrono::weekday_last
2866 weekday_last() const noexcept
2870 operator sys_days() const noexcept
2872 const auto __d = sys_days{_M_y / _M_m / last};
2873 return sys_days{(__d - (chrono::weekday{__d}
2874 - _M_wdl.weekday())).time_since_epoch()};
2878 operator local_days() const noexcept
2879 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2883 {
return _M_y.ok() && _M_m.ok() && _M_wdl.ok(); }
2885 friend constexpr
bool
2886 operator==(
const year_month_weekday_last& __x,
2887 const year_month_weekday_last& __y) noexcept
2889 return __x.year() == __y.year()
2890 && __x.month() == __y.month()
2891 && __x.weekday_last() == __y.weekday_last();
2894 template<
typename = __detail::__months_years_conversion_disambiguator>
2895 friend constexpr year_month_weekday_last
2896 operator+(
const year_month_weekday_last& __ymwdl,
2897 const months& __dm) noexcept
2899 return ((__ymwdl.year() / __ymwdl.month() + __dm)
2900 / __ymwdl.weekday_last());
2903 template<
typename = __detail::__months_years_conversion_disambiguator>
2904 friend constexpr year_month_weekday_last
2906 const year_month_weekday_last& __ymwdl) noexcept
2907 {
return __ymwdl + __dm; }
2909 friend constexpr year_month_weekday_last
2910 operator+(
const year_month_weekday_last& __ymwdl,
2911 const years& __dy) noexcept
2912 {
return {__ymwdl.year() + __dy, __ymwdl.month(), __ymwdl.weekday_last()}; }
2914 friend constexpr year_month_weekday_last
2916 const year_month_weekday_last& __ymwdl) noexcept
2917 {
return __ymwdl + __dy; }
2919 template<
typename = __detail::__months_years_conversion_disambiguator>
2920 friend constexpr year_month_weekday_last
2921 operator-(
const year_month_weekday_last& __ymwdl,
2922 const months& __dm) noexcept
2923 {
return __ymwdl + -__dm; }
2925 friend constexpr year_month_weekday_last
2926 operator-(
const year_month_weekday_last& __ymwdl,
2927 const years& __dy) noexcept
2928 {
return __ymwdl + -__dy; }
2930 friend constexpr year_month_weekday_last
2932 const chrono::weekday_last& __wdl) noexcept
2933 {
return {__ym.year(), __ym.month(), __wdl}; }
2935 friend constexpr year_month_weekday_last
2937 const chrono::month_weekday_last& __mwdl) noexcept
2938 {
return {__y, __mwdl.month(), __mwdl.weekday_last()}; }
2940 friend constexpr year_month_weekday_last
2941 operator/(
int __y,
const chrono::month_weekday_last& __mwdl) noexcept
2942 {
return chrono::year(__y) / __mwdl; }
2944 friend constexpr year_month_weekday_last
2945 operator/(
const chrono::month_weekday_last& __mwdl,
2946 const chrono::year& __y) noexcept
2947 {
return __y / __mwdl; }
2949 friend constexpr year_month_weekday_last
2950 operator/(
const chrono::month_weekday_last& __mwdl,
int __y) noexcept
2951 {
return chrono::year(__y) / __mwdl; }
2961 __pow10(
unsigned __n)
2970 template<
typename _Duration>
2974 static constexpr
int
2975 _S_fractional_width()
2977 int __multiplicity_2 = 0;
2978 int __multiplicity_5 = 0;
2979 auto __den = _Duration::period::den;
2980 while ((__den % 2) == 0)
2985 while ((__den % 5) == 0)
2993 int __width = (__multiplicity_2 > __multiplicity_5
2994 ? __multiplicity_2 : __multiplicity_5);
3001 static constexpr
unsigned fractional_width = {_S_fractional_width()};
3005 chrono::seconds::rep>,
3006 ratio<1, __detail::__pow10(fractional_width)>>;
3010 : hh_mm_ss{_Duration::zero()}
3014 hh_mm_ss(_Duration __d) noexcept
3015 : _M_is_neg (__d < _Duration::zero()),
3016 _M_h (duration_cast<chrono::hours>(abs(__d))),
3017 _M_m (duration_cast<chrono::minutes>(abs(__d) -
hours())),
3018 _M_s (duration_cast<chrono::seconds>(abs(__d) -
hours() -
minutes()))
3020 if constexpr (treat_as_floating_point_v<typename precision::rep>)
3023 _M_ss = duration_cast<precision>(abs(__d) -
hours()
3028 is_negative() const noexcept
3029 {
return _M_is_neg; }
3032 hours() const noexcept
3044 subseconds() const noexcept
3048 operator precision() const noexcept
3049 {
return to_duration(); }
3052 to_duration() const noexcept
3055 return -(_M_h + _M_m + _M_s + _M_ss);
3057 return _M_h + _M_m + _M_s + _M_ss;
3074 #if __cplusplus > 201103L
3076 #define __cpp_lib_chrono_udls 201304
3078 inline namespace literals
3103 inline namespace chrono_literals
3105 #pragma GCC diagnostic push
3106 #pragma GCC diagnostic ignored "-Wliteral-suffix"
3108 template<
typename _Dur,
char... _Digits>
3109 constexpr _Dur __check_overflow()
3111 using _Val = __parse_int::_Parse_int<_Digits...>;
3112 constexpr
typename _Dur::rep __repval = _Val::value;
3113 static_assert(__repval >= 0 && __repval == _Val::value,
3114 "literal value cannot be represented by duration type");
3115 return _Dur(__repval);
3121 operator""h(
long double __hours)
3125 template <
char... _Digits>
3132 operator""min(
long double __mins)
3136 template <
char... _Digits>
3143 operator""s(
long double __secs)
3147 template <
char... _Digits>
3154 operator""ms(
long double __msecs)
3158 template <
char... _Digits>
3165 operator""us(
long double __usecs)
3169 template <
char... _Digits>
3176 operator""ns(
long double __nsecs)
3180 template <
char... _Digits>
3185 #if __cplusplus > 201703L
3186 constexpr chrono::day
3187 operator""d(
unsigned long long __d) noexcept
3188 {
return chrono::day{
static_cast<unsigned>(__d)}; }
3190 constexpr chrono::year
3191 operator""y(
unsigned long long __y) noexcept
3192 {
return chrono::year{
static_cast<int>(__y)}; }
3195 #pragma GCC diagnostic pop
3201 using namespace literals::chrono_literals;
3204 #if __cplusplus > 201703L
3210 is_am(
const hours& __h) noexcept
3211 {
return 0h <= __h && __h <= 11h; }
3214 is_pm(
const hours& __h) noexcept
3215 {
return 12h <= __h && __h <= 23h; }
3218 make12(
const hours& __h) noexcept
3228 make24(
const hours& __h,
bool __is_pm) noexcept
3248 #if __cplusplus >= 201703L
3249 namespace filesystem
3254 using rep = duration::rep;
3255 using period = duration::period;
3256 using time_point = chrono::time_point<__file_clock>;
3257 static constexpr
bool is_steady =
false;
3261 {
return _S_from_sys(chrono::system_clock::now()); }
3263 #if __cplusplus > 201703L
3264 template<
typename _Dur>
3266 chrono::file_time<_Dur>
3267 from_sys(
const chrono::sys_time<_Dur>& __t) noexcept
3268 {
return _S_from_sys(__t); }
3271 template<
typename _Dur>
3273 chrono::sys_time<_Dur>
3274 to_sys(
const chrono::file_time<_Dur>& __t) noexcept
3275 {
return _S_to_sys(__t); }
3279 using __sys_clock = chrono::system_clock;
3288 template<
typename _Dur>
3290 chrono::time_point<__file_clock, _Dur>
3291 _S_from_sys(
const chrono::time_point<__sys_clock, _Dur>& __t) noexcept
3293 using __file_time = chrono::time_point<__file_clock, _Dur>;
3294 return __file_time{__t.time_since_epoch()} - _S_epoch_diff;
3298 template<
typename _Dur>
3300 chrono::time_point<__sys_clock, _Dur>
3301 _S_to_sys(
const chrono::time_point<__file_clock, _Dur>& __t) noexcept
3303 using __sys_time = chrono::time_point<__sys_clock, _Dur>;
3304 return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
3311 _GLIBCXX_END_NAMESPACE_VERSION
constexpr duration< __common_rep_t< _Rep2, _Rep1 >, _Period > operator*(const _Rep1 &__s, const duration< _Rep2, _Period > &__d)
Multiply a duration by a scalar value.
duration< int64_t, milli > milliseconds
milliseconds
constexpr enable_if< __is_duration< _ToDur >::value, time_point< _Clock, _ToDur > >::type time_point_cast(const time_point< _Clock, _Dur > &__t)
time_point_cast
constexpr time_point< _Clock, typename common_type< _Dur1, duration< _Rep2, _Period2 > >::type > operator-(const time_point< _Clock, _Dur1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
Adjust a time point backwards by the given duration.
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
duration_cast
constexpr common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator-(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
The difference between two durations.
duration< int64_t, ratio< 3600 > > hours
hours
constexpr time_point< _Clock, typename common_type< _Dur1, duration< _Rep2, _Period2 > >::type > operator+(const time_point< _Clock, _Dur1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
duration< int64_t, ratio< 60 > > minutes
minutes
constexpr common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator+(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr time_point< _Clock, typename common_type< duration< _Rep1, _Period1 >, _Dur2 >::type > operator+(const duration< _Rep1, _Period1 > &__lhs, const time_point< _Clock, _Dur2 > &__rhs)
Adjust a time point forwards by the given duration.
duration< int64_t, nano > nanoseconds
nanoseconds
constexpr common_type< _Dur1, _Dur2 >::type operator-(const time_point< _Clock, _Dur1 > &__lhs, const time_point< _Clock, _Dur2 > &__rhs)
constexpr duration< __common_rep_t< _Rep1, _Rep2 >, _Period > operator*(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
duration< int64_t, micro > microseconds
microseconds
duration< int64_t > seconds
seconds
constexpr complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
constexpr complex< _Tp > operator-(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x minus y.
constexpr complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
typename __ratio_divide< _R1, _R2 >::type ratio_divide
ratio_divide
void void_t
A metafunction that always yields void, used for detecting valid types.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
constexpr const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
ISO C++ entities toplevel namespace is std.
Properties of fundamental types.
static constexpr _Tp max() noexcept
static constexpr _Tp lowest() noexcept
Provides compile-time rational arithmetic.
Define a member typedef type only if a boolean constant is true.