Definition at line 33 of file Time.h.
#include <Time.h>
◆ Time()
NumLib::Time::Time |
( |
double const | time | ) |
|
|
inlineexplicitconstexpr |
◆ operator()()
double NumLib::Time::operator() |
( |
| ) |
const |
|
inlineconstexpr |
◆ operator+()
Time NumLib::Time::operator+ |
( |
double const | increment | ) |
const |
|
inlineconstexpr |
Definition at line 45 of file Time.h.
46 {
48 result += increment;
49 return result;
50 }
constexpr Time(double const time)
◆ operator+=()
Time & NumLib::Time::operator+= |
( |
double const | increment | ) |
|
|
inlineconstexpr |
Definition at line 39 of file Time.h.
40 {
42 return *this;
43 }
References value_.
◆ operator-()
Time NumLib::Time::operator- |
( |
double const | decrement | ) |
const |
|
inlineconstexpr |
Definition at line 58 of file Time.h.
59 {
61 result -= decrement;
62 return result;
63 }
◆ operator-=()
Time & NumLib::Time::operator-= |
( |
double const | decrement | ) |
|
|
inlineconstexpr |
Definition at line 52 of file Time.h.
53 {
55 return *this;
56 }
References value_.
◆ operator<=>()
std::weak_ordering NumLib::Time::operator<=> |
( |
Time const & | b | ) |
const |
|
inlineconstexpr |
Definition at line 65 of file Time.h.
66 {
67 Time const& a = *
this;
68 double const diff = b() - a();
69
70 double const eps = 10 * std::numeric_limits<double>::epsilon() *
71 std::max(1., (std::abs(a()) + std::abs(b())) / 2);
72
73
74
75
76
77 if (diff < -eps)
78 {
79 return std::weak_ordering::greater;
80 }
81 if (diff > eps)
82 {
83 return std::weak_ordering::less;
84 }
85 return std::weak_ordering::equivalent;
86 }
◆ operator==()
bool NumLib::Time::operator== |
( |
Time const & | x | ) |
const |
|
inlineconstexpr |
Definition at line 88 of file Time.h.
89 {
90 return (*this <=> x) == std::weak_ordering::equivalent;
91 }
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
Time const & | t ) |
|
friend |
Definition at line 93 of file Time.h.
94 {
95 auto const precision = os.precision();
96 return os << std::setprecision(
97 std::numeric_limits<double>::max_digits10)
98 << t() << std::setprecision(precision);
99 }
◆ value_
The documentation for this struct was generated from the following file: