29 #ifndef _GLIBCXX_CHRONO
30 #define _GLIBCXX_CHRONO 1
32 #pragma GCC system_header
34 #if __cplusplus < 201103L
44 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
46 namespace std _GLIBCXX_VISIBILITY(default)
61 _GLIBCXX_BEGIN_NAMESPACE_VERSION
63 template<
typename _Rep,
typename _Period = ratio<1>>
66 template<
typename _Clock,
typename _Dur =
typename _Clock::duration>
69 _GLIBCXX_END_NAMESPACE_VERSION
72 _GLIBCXX_BEGIN_NAMESPACE_VERSION
76 template<
typename _CT,
typename _Period1,
typename _Period2>
77 struct __duration_common_type_wrapper
80 typedef __static_gcd<_Period1::num, _Period2::num> __gcd_num;
81 typedef __static_gcd<_Period1::den, _Period2::den> __gcd_den;
82 typedef typename _CT::type __cr;
83 typedef ratio<__gcd_num::value,
84 (_Period1::den / __gcd_den::value) * _Period2::den> __r;
86 typedef __success_type<chrono::duration<__cr, __r>> type;
89 template<
typename _Period1,
typename _Period2>
90 struct __duration_common_type_wrapper<__failure_type, _Period1, _Period2>
91 {
typedef __failure_type type; };
93 template<
typename _Rep1,
typename _Period1,
typename _Rep2,
typename _Period2>
94 struct common_type<chrono::duration<_Rep1, _Period1>,
95 chrono::duration<_Rep2, _Period2>>
96 :
public __duration_common_type_wrapper<typename __member_type_wrapper<
97 common_type<_Rep1, _Rep2>>::type, _Period1, _Period2>::type
102 template<
typename _CT,
typename _Clock>
103 struct __timepoint_common_type_wrapper
105 typedef __success_type<chrono::time_point<_Clock, typename _CT::type>>
109 template<
typename _Clock>
110 struct __timepoint_common_type_wrapper<__failure_type, _Clock>
111 {
typedef __failure_type type; };
113 template<
typename _Clock,
typename _Duration1,
typename _Duration2>
114 struct common_type<chrono::time_point<_Clock, _Duration1>,
115 chrono::time_point<_Clock, _Duration2>>
116 :
public __timepoint_common_type_wrapper<typename __member_type_wrapper<
117 common_type<_Duration1, _Duration2>>::type, _Clock>::type
120 _GLIBCXX_END_NAMESPACE_VERSION
124 _GLIBCXX_BEGIN_NAMESPACE_VERSION
127 template<
typename _ToDur,
typename _CF,
typename _CR,
128 bool _NumIsOne =
false,
bool _DenIsOne =
false>
129 struct __duration_cast_impl
131 template<
typename _Rep,
typename _Period>
132 static constexpr _ToDur
133 __cast(
const duration<_Rep, _Period>& __d)
135 typedef typename _ToDur::rep __to_rep;
136 return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count())
137 * static_cast<_CR>(_CF::num)
138 /
static_cast<_CR
>(_CF::den)));
142 template<
typename _ToDur,
typename _CF,
typename _CR>
143 struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
145 template<
typename _Rep,
typename _Period>
146 static constexpr _ToDur
147 __cast(
const duration<_Rep, _Period>& __d)
149 typedef typename _ToDur::rep __to_rep;
150 return _ToDur(static_cast<__to_rep>(__d.count()));
154 template<
typename _ToDur,
typename _CF,
typename _CR>
155 struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
157 template<
typename _Rep,
typename _Period>
158 static constexpr _ToDur
159 __cast(
const duration<_Rep, _Period>& __d)
161 typedef typename _ToDur::rep __to_rep;
162 return _ToDur(static_cast<__to_rep>(
163 static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
167 template<
typename _ToDur,
typename _CF,
typename _CR>
168 struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
170 template<
typename _Rep,
typename _Period>
171 static constexpr _ToDur
172 __cast(
const duration<_Rep, _Period>& __d)
174 typedef typename _ToDur::rep __to_rep;
175 return _ToDur(static_cast<__to_rep>(
176 static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
180 template<
typename _Tp>
185 template<
typename _Rep,
typename _Period>
186 struct __is_duration<duration<_Rep, _Period>>
191 template<
typename _ToDur,
typename _Rep,
typename _Period>
192 constexpr
typename enable_if<__is_duration<_ToDur>::value,
196 typedef typename _ToDur::period __to_period;
197 typedef typename _ToDur::rep __to_rep;
199 typedef typename common_type<__to_rep, _Rep, intmax_t>::type
201 typedef __duration_cast_impl<_ToDur, __cf, __cr,
202 __cf::num == 1, __cf::den == 1> __dc;
203 return __dc::__cast(__d);
207 template<
typename _Rep>
212 #if __cplusplus > 201402L
213 template <
typename _Rep>
214 inline constexpr
bool treat_as_floating_point_v =
218 #if __cplusplus > 201402L
219 # define __cpp_lib_chrono 201510
221 template<
typename _ToDur,
typename _Rep,
typename _Period>
222 constexpr enable_if_t<__is_duration<_ToDur>::value, _ToDur>
227 return __to - _ToDur{1};
231 template<
typename _ToDur,
typename _Rep,
typename _Period>
232 constexpr enable_if_t<__is_duration<_ToDur>::value, _ToDur>
233 ceil(
const duration<_Rep, _Period>& __d)
237 return __to + _ToDur{1};
241 template <
typename _ToDur,
typename _Rep,
typename _Period>
242 constexpr enable_if_t<
243 __and_<__is_duration<_ToDur>,
244 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
246 round(
const duration<_Rep, _Period>& __d)
248 _ToDur __t0 = chrono::floor<_ToDur>(__d);
249 _ToDur __t1 = __t0 + _ToDur{1};
250 auto __diff0 = __d - __t0;
251 auto __diff1 = __t1 - __d;
252 if (__diff0 == __diff1)
254 if (__t0.count() & 1)
258 else if (__diff0 < __diff1)
263 template<
typename _Rep,
typename _Period>
265 enable_if_t<numeric_limits<_Rep>::is_signed, duration<_Rep, _Period>>
266 abs(duration<_Rep, _Period> __d)
268 if (__d >= __d.zero())
275 template<
typename _Rep>
278 static constexpr _Rep
282 static constexpr _Rep
286 static constexpr _Rep
291 template<
typename _Tp>
296 template<
intmax_t _Num,
intmax_t _Den>
297 struct __is_ratio<
ratio<_Num, _Den>>
302 template<
typename _Rep,
typename _Period>
306 typedef _Period period;
308 static_assert(!__is_duration<_Rep>::value,
"rep cannot be a duration");
309 static_assert(__is_ratio<_Period>::value,
310 "period must be a specialization of ratio");
311 static_assert(_Period::num > 0,
"period must be positive");
314 constexpr duration() =
default;
319 duration(
const duration&) =
default;
321 template<
typename _Rep2,
typename =
typename
322 enable_if<is_convertible<_Rep2, rep>::value
323 && (treat_as_floating_point<rep>::value
324 || !treat_as_floating_point<_Rep2>::value)>::type>
325 constexpr
explicit duration(
const _Rep2& __rep)
326 : __r(static_cast<rep>(__rep)) { }
328 template<
typename _Rep2,
typename _Period2,
typename =
typename
329 enable_if<treat_as_floating_point<rep>::value
330 || (ratio_divide<_Period2, period>::den == 1
331 && !treat_as_floating_point<_Rep2>::value)>::type>
332 constexpr duration(
const duration<_Rep2, _Period2>& __d)
333 : __r(duration_cast<duration>(__d).count()) { }
335 ~duration() =
default;
336 duration& operator=(
const duration&) =
default;
350 {
return duration(-__r); }
352 _GLIBCXX17_CONSTEXPR duration&
359 _GLIBCXX17_CONSTEXPR duration
361 {
return duration(__r++); }
363 _GLIBCXX17_CONSTEXPR duration&
370 _GLIBCXX17_CONSTEXPR duration
372 {
return duration(__r--); }
374 _GLIBCXX17_CONSTEXPR duration&
375 operator+=(
const duration& __d)
381 _GLIBCXX17_CONSTEXPR duration&
382 operator-=(
const duration& __d)
388 _GLIBCXX17_CONSTEXPR duration&
389 operator*=(
const rep& __rhs)
395 _GLIBCXX17_CONSTEXPR duration&
396 operator/=(
const rep& __rhs)
403 template<
typename _Rep2 = rep>
405 typename enable_if<!treat_as_floating_point<_Rep2>::value,
407 operator%=(
const rep& __rhs)
413 template<
typename _Rep2 = rep>
415 typename enable_if<!treat_as_floating_point<_Rep2>::value,
417 operator%=(
const duration& __d)
424 static constexpr duration
426 {
return duration(duration_values<rep>::zero()); }
428 static constexpr duration
432 static constexpr duration
440 template<
typename _Rep1,
typename _Period1,
441 typename _Rep2,
typename _Period2>
442 constexpr
typename common_type<duration<_Rep1, _Period1>,
443 duration<_Rep2, _Period2>>::type
444 operator+(
const duration<_Rep1, _Period1>& __lhs,
445 const duration<_Rep2, _Period2>& __rhs)
447 typedef duration<_Rep1, _Period1> __dur1;
448 typedef duration<_Rep2, _Period2> __dur2;
449 typedef typename common_type<__dur1,__dur2>::type __cd;
450 return __cd(__cd(__lhs).count() + __cd(__rhs).count());
453 template<
typename _Rep1,
typename _Period1,
454 typename _Rep2,
typename _Period2>
455 constexpr
typename common_type<duration<_Rep1, _Period1>,
456 duration<_Rep2, _Period2>>::type
457 operator-(
const duration<_Rep1, _Period1>& __lhs,
458 const duration<_Rep2, _Period2>& __rhs)
460 typedef duration<_Rep1, _Period1> __dur1;
461 typedef duration<_Rep2, _Period2> __dur2;
462 typedef typename common_type<__dur1,__dur2>::type __cd;
463 return __cd(__cd(__lhs).count() - __cd(__rhs).count());
466 template<
typename _Rep1,
typename _Rep2,
bool =
467 is_convertible<_Rep2,
468 typename common_type<_Rep1, _Rep2>::type>::value>
469 struct __common_rep_type { };
471 template<
typename _Rep1,
typename _Rep2>
472 struct __common_rep_type<_Rep1, _Rep2, true>
473 {
typedef typename common_type<_Rep1, _Rep2>::type type; };
475 template<
typename _Rep1,
typename _Period,
typename _Rep2>
477 duration<typename __common_rep_type<_Rep1, _Rep2>::type, _Period>
478 operator*(
const duration<_Rep1, _Period>& __d,
const _Rep2& __s)
480 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
482 return __cd(__cd(__d).count() * __s);
485 template<
typename _Rep1,
typename _Rep2,
typename _Period>
487 duration<typename __common_rep_type<_Rep2, _Rep1>::type, _Period>
488 operator*(
const _Rep1& __s,
const duration<_Rep2, _Period>& __d)
489 {
return __d * __s; }
491 template<
typename _Rep1,
typename _Period,
typename _Rep2>
492 constexpr duration<
typename __common_rep_type<_Rep1,
typename
493 enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
494 operator/(
const duration<_Rep1, _Period>& __d,
const _Rep2& __s)
496 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
498 return __cd(__cd(__d).count() / __s);
501 template<
typename _Rep1,
typename _Period1,
502 typename _Rep2,
typename _Period2>
503 constexpr
typename common_type<_Rep1, _Rep2>::type
504 operator/(
const duration<_Rep1, _Period1>& __lhs,
505 const duration<_Rep2, _Period2>& __rhs)
507 typedef duration<_Rep1, _Period1> __dur1;
508 typedef duration<_Rep2, _Period2> __dur2;
509 typedef typename common_type<__dur1,__dur2>::type __cd;
510 return __cd(__lhs).count() / __cd(__rhs).count();
514 template<
typename _Rep1,
typename _Period,
typename _Rep2>
515 constexpr duration<
typename __common_rep_type<_Rep1,
typename
516 enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
517 operator%(
const duration<_Rep1, _Period>& __d,
const _Rep2& __s)
519 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
521 return __cd(__cd(__d).count() % __s);
524 template<
typename _Rep1,
typename _Period1,
525 typename _Rep2,
typename _Period2>
526 constexpr
typename common_type<duration<_Rep1, _Period1>,
527 duration<_Rep2, _Period2>>::type
528 operator%(
const duration<_Rep1, _Period1>& __lhs,
529 const duration<_Rep2, _Period2>& __rhs)
531 typedef duration<_Rep1, _Period1> __dur1;
532 typedef duration<_Rep2, _Period2> __dur2;
533 typedef typename common_type<__dur1,__dur2>::type __cd;
534 return __cd(__cd(__lhs).count() % __cd(__rhs).count());
538 template<
typename _Rep1,
typename _Period1,
539 typename _Rep2,
typename _Period2>
541 operator==(
const duration<_Rep1, _Period1>& __lhs,
542 const duration<_Rep2, _Period2>& __rhs)
544 typedef duration<_Rep1, _Period1> __dur1;
545 typedef duration<_Rep2, _Period2> __dur2;
546 typedef typename common_type<__dur1,__dur2>::type __ct;
547 return __ct(__lhs).count() == __ct(__rhs).count();
550 template<
typename _Rep1,
typename _Period1,
551 typename _Rep2,
typename _Period2>
553 operator<(const duration<_Rep1, _Period1>& __lhs,
554 const duration<_Rep2, _Period2>& __rhs)
556 typedef duration<_Rep1, _Period1> __dur1;
557 typedef duration<_Rep2, _Period2> __dur2;
558 typedef typename common_type<__dur1,__dur2>::type __ct;
559 return __ct(__lhs).count() < __ct(__rhs).count();
562 template<
typename _Rep1,
typename _Period1,
563 typename _Rep2,
typename _Period2>
565 operator!=(
const duration<_Rep1, _Period1>& __lhs,
566 const duration<_Rep2, _Period2>& __rhs)
567 {
return !(__lhs == __rhs); }
569 template<
typename _Rep1,
typename _Period1,
570 typename _Rep2,
typename _Period2>
572 operator<=(const duration<_Rep1, _Period1>& __lhs,
573 const duration<_Rep2, _Period2>& __rhs)
574 {
return !(__rhs < __lhs); }
576 template<
typename _Rep1,
typename _Period1,
577 typename _Rep2,
typename _Period2>
579 operator>(
const duration<_Rep1, _Period1>& __lhs,
580 const duration<_Rep2, _Period2>& __rhs)
581 {
return __rhs < __lhs; }
583 template<
typename _Rep1,
typename _Period1,
584 typename _Rep2,
typename _Period2>
586 operator>=(
const duration<_Rep1, _Period1>& __lhs,
587 const duration<_Rep2, _Period2>& __rhs)
588 {
return !(__lhs < __rhs); }
609 template<
typename _Clock,
typename _Dur>
612 typedef _Clock clock;
614 typedef typename duration::rep rep;
615 typedef typename duration::period period;
617 constexpr
time_point() : __d(duration::zero())
620 constexpr
explicit time_point(
const duration& __dur)
625 template<
typename _Dur2>
627 : __d(__t.time_since_epoch())
632 time_since_epoch()
const
636 _GLIBCXX17_CONSTEXPR time_point&
643 _GLIBCXX17_CONSTEXPR time_point&
651 static constexpr time_point
655 static constexpr time_point
664 template<
typename _ToDur,
typename _Clock,
typename _Dur>
665 constexpr
typename enable_if<__is_duration<_ToDur>::value,
666 time_point<_Clock, _ToDur>>::type
670 return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
673 #if __cplusplus > 201402L
674 template<
typename _ToDur,
typename _Clock,
typename _Dur>
676 enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>
677 floor(
const time_point<_Clock, _Dur>& __tp)
679 return time_point<_Clock, _ToDur>{
680 chrono::floor<_ToDur>(__tp.time_since_epoch())};
683 template<
typename _ToDur,
typename _Clock,
typename _Dur>
685 enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>
686 ceil(
const time_point<_Clock, _Dur>& __tp)
688 return time_point<_Clock, _ToDur>{
689 chrono::ceil<_ToDur>(__tp.time_since_epoch())};
692 template<
typename _ToDur,
typename _Clock,
typename _Dur>
693 constexpr enable_if_t<
694 __and_<__is_duration<_ToDur>,
695 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
696 time_point<_Clock, _ToDur>>
697 round(
const time_point<_Clock, _Dur>& __tp)
699 return time_point<_Clock, _ToDur>{
700 chrono::round<_ToDur>(__tp.time_since_epoch())};
704 template<
typename _Clock,
typename _Dur1,
705 typename _Rep2,
typename _Period2>
706 constexpr time_point<_Clock,
707 typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
708 operator+(
const time_point<_Clock, _Dur1>& __lhs,
709 const duration<_Rep2, _Period2>& __rhs)
711 typedef duration<_Rep2, _Period2> __dur2;
712 typedef typename common_type<_Dur1,__dur2>::type __ct;
713 typedef time_point<_Clock, __ct> __time_point;
714 return __time_point(__lhs.time_since_epoch() + __rhs);
717 template<
typename _Rep1,
typename _Period1,
718 typename _Clock,
typename _Dur2>
719 constexpr time_point<_Clock,
720 typename common_type<duration<_Rep1, _Period1>, _Dur2>::type>
721 operator+(
const duration<_Rep1, _Period1>& __lhs,
722 const time_point<_Clock, _Dur2>& __rhs)
724 typedef duration<_Rep1, _Period1> __dur1;
725 typedef typename common_type<__dur1,_Dur2>::type __ct;
726 typedef time_point<_Clock, __ct> __time_point;
727 return __time_point(__rhs.time_since_epoch() + __lhs);
730 template<
typename _Clock,
typename _Dur1,
731 typename _Rep2,
typename _Period2>
732 constexpr time_point<_Clock,
733 typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
734 operator-(
const time_point<_Clock, _Dur1>& __lhs,
735 const duration<_Rep2, _Period2>& __rhs)
737 typedef duration<_Rep2, _Period2> __dur2;
738 typedef typename common_type<_Dur1,__dur2>::type __ct;
739 typedef time_point<_Clock, __ct> __time_point;
740 return __time_point(__lhs.time_since_epoch() -__rhs);
743 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
744 constexpr
typename common_type<_Dur1, _Dur2>::type
745 operator-(
const time_point<_Clock, _Dur1>& __lhs,
746 const time_point<_Clock, _Dur2>& __rhs)
747 {
return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
749 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
751 operator==(
const time_point<_Clock, _Dur1>& __lhs,
752 const time_point<_Clock, _Dur2>& __rhs)
753 {
return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
755 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
757 operator!=(
const time_point<_Clock, _Dur1>& __lhs,
758 const time_point<_Clock, _Dur2>& __rhs)
759 {
return !(__lhs == __rhs); }
761 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
763 operator<(const time_point<_Clock, _Dur1>& __lhs,
764 const time_point<_Clock, _Dur2>& __rhs)
765 {
return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
767 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
769 operator<=(const time_point<_Clock, _Dur1>& __lhs,
770 const time_point<_Clock, _Dur2>& __rhs)
771 {
return !(__rhs < __lhs); }
773 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
775 operator>(
const time_point<_Clock, _Dur1>& __lhs,
776 const time_point<_Clock, _Dur2>& __rhs)
777 {
return __rhs < __lhs; }
779 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
781 operator>=(
const time_point<_Clock, _Dur1>& __lhs,
782 const time_point<_Clock, _Dur2>& __rhs)
783 {
return !(__lhs < __rhs); }
804 inline namespace _V2 {
814 typedef duration::rep rep;
815 typedef duration::period period;
819 < system_clock::duration::zero(),
820 "a clock's minimum duration cannot be less than its epoch");
822 static constexpr
bool is_steady =
false;
831 return std::time_t(duration_cast<chrono::seconds>
832 (__t.time_since_epoch()).count());
836 from_time_t(std::time_t __t) noexcept
853 typedef duration::rep rep;
854 typedef duration::period period;
857 static constexpr
bool is_steady =
true;
875 _GLIBCXX_END_NAMESPACE_VERSION
878 #if __cplusplus > 201103L
880 #define __cpp_lib_chrono_udls 201304
882 inline namespace literals
884 inline namespace chrono_literals
886 _GLIBCXX_BEGIN_NAMESPACE_VERSION
888 template<
typename _Rep,
unsigned long long _Val>
889 struct _Checked_integral_constant
892 static_assert(_Checked_integral_constant::value >= 0
893 && _Checked_integral_constant::value == _Val,
894 "literal value cannot be represented by duration type");
897 template<
typename _Dur,
char... _Digits>
898 constexpr _Dur __check_overflow()
900 using _Val = __parse_int::_Parse_int<_Digits...>;
901 using _Rep =
typename _Dur::rep;
904 using _CheckedVal = _Checked_integral_constant<_Rep, _Val::value>;
905 return _Dur{_CheckedVal::value};
908 constexpr chrono::duration<long double, ratio<3600,1>>
909 operator""h(
long double __hours)
910 {
return chrono::duration<long double, ratio<3600,1>>{__hours}; }
912 template <
char... _Digits>
917 constexpr chrono::duration<long double, ratio<60,1>>
918 operator""min(
long double __mins)
919 {
return chrono::duration<long double, ratio<60,1>>{__mins}; }
921 template <
char... _Digits>
926 constexpr chrono::duration<long double>
927 operator""s(
long double __secs)
928 {
return chrono::duration<long double>{__secs}; }
930 template <
char... _Digits>
935 constexpr chrono::duration<long double, milli>
936 operator""ms(
long double __msecs)
937 {
return chrono::duration<long double, milli>{__msecs}; }
939 template <
char... _Digits>
944 constexpr chrono::duration<long double, micro>
945 operator""us(
long double __usecs)
946 {
return chrono::duration<long double, micro>{__usecs}; }
948 template <
char... _Digits>
953 constexpr chrono::duration<long double, nano>
954 operator""ns(
long double __nsecs)
955 {
return chrono::duration<long double, nano>{__nsecs}; }
957 template <
char... _Digits>
962 _GLIBCXX_END_NAMESPACE_VERSION
968 _GLIBCXX_BEGIN_NAMESPACE_VERSION
970 using namespace literals::chrono_literals;
972 _GLIBCXX_END_NAMESPACE_VERSION
975 #endif // __cplusplus > 201103L
980 #endif //_GLIBCXX_USE_C99_STDINT_TR1
984 #endif //_GLIBCXX_CHRONO
duration< int64_t, nano > nanoseconds
nanoseconds
duration< int64_t, ratio< 3600 > > hours
hours
complex< _Tp > operator-(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x minus y.
static constexpr _Tp lowest() noexcept
duration< int64_t, micro > microseconds
microseconds
Provides compile-time rational arithmetic.
complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
_GLIBCXX14_CONSTEXPR const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
duration< int64_t > seconds
seconds
duration< int64_t, milli > milliseconds
milliseconds
typename __ratio_divide< _R1, _R2 >::type ratio_divide
ratio_divide
constexpr enable_if< __is_duration< _ToDur >::value, _ToDur >::type duration_cast(const duration< _Rep, _Period > &__d)
duration_cast
duration< int64_t, ratio< 60 > > minutes
minutes
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
constexpr enable_if< __is_duration< _ToDur >::value, time_point< _Clock, _ToDur > >::type time_point_cast(const time_point< _Clock, _Dur > &__t)
time_point_cast
static constexpr _Tp max() noexcept
_GLIBCXX14_CONSTEXPR const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.