Definition at line 32 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 44 of file Time.h.
45 {
47 result += increment;
48 return result;
49 }
constexpr Time(double const time)
◆ operator+=()
Time & NumLib::Time::operator+= |
( |
double const | increment | ) |
|
|
inlineconstexpr |
Definition at line 38 of file Time.h.
39 {
41 return *this;
42 }
References value_.
◆ operator-()
Time NumLib::Time::operator- |
( |
double const | decrement | ) |
const |
|
inlineconstexpr |
Definition at line 57 of file Time.h.
58 {
60 result -= decrement;
61 return result;
62 }
◆ operator-=()
Time & NumLib::Time::operator-= |
( |
double const | decrement | ) |
|
|
inlineconstexpr |
Definition at line 51 of file Time.h.
52 {
54 return *this;
55 }
References value_.
◆ operator<=>()
std::weak_ordering NumLib::Time::operator<=> |
( |
Time const & | b | ) |
const |
|
inlineconstexpr |
Definition at line 64 of file Time.h.
65 {
66 Time const& a = *
this;
67 double const diff = b() - a();
68
69 double const eps = 10 * std::numeric_limits<double>::epsilon() *
70 std::max(1., (std::abs(a()) + std::abs(b())) / 2);
71
72
73
74
75
76 if (diff < -eps)
77 {
78 return std::weak_ordering::greater;
79 }
80 if (diff > eps)
81 {
82 return std::weak_ordering::less;
83 }
84 return std::weak_ordering::equivalent;
85 }
◆ operator==()
bool NumLib::Time::operator== |
( |
Time const & | x | ) |
const |
|
inlineconstexpr |
Definition at line 87 of file Time.h.
88 {
89 return (*this <=> x) == std::weak_ordering::equivalent;
90 }
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
Time const & | t ) |
|
friend |
Definition at line 92 of file Time.h.
93 {
94 auto const precision = os.precision();
95 return os << std::setprecision(
96 std::numeric_limits<double>::max_digits10)
97 << t() << std::setprecision(precision);
98 }
◆ value_
The documentation for this struct was generated from the following file: