Commit f7311b836426e4e2ddebaf91791142e7147317aa
1 parent
23307fc3
add comparison operators
Showing
1 changed file
with
24 additions
and
0 deletions
include/GEnergy.hpp
| ... | ... | @@ -45,6 +45,10 @@ class GEnergy { |
| 45 | 45 | friend GEnergy operator* (const GEnergy &a, const double &b); |
| 46 | 46 | friend bool operator== (const GEnergy &a, const GEnergy &b); |
| 47 | 47 | friend bool operator!= (const GEnergy &a, const GEnergy &b); |
| 48 | + friend bool operator< (const GEnergy &a, const GEnergy &b); | |
| 49 | + friend bool operator<= (const GEnergy &a, const GEnergy &b); | |
| 50 | + friend bool operator> (const GEnergy &a, const GEnergy &b); | |
| 51 | + friend bool operator>= (const GEnergy &a, const GEnergy &b); | |
| 48 | 52 | |
| 49 | 53 | public: |
| 50 | 54 | // Constructors and destructors |
| ... | ... | @@ -117,5 +121,25 @@ bool operator!= (const GEnergy &a, const GEnergy &b) |
| 117 | 121 | { |
| 118 | 122 | return (a.m_energy != b.m_energy); |
| 119 | 123 | } |
| 124 | +inline | |
| 125 | +bool operator< (const GEnergy &a, const GEnergy &b) | |
| 126 | +{ | |
| 127 | + return (a.m_energy < b.m_energy); | |
| 128 | +} | |
| 129 | +inline | |
| 130 | +bool operator<= (const GEnergy &a, const GEnergy &b) | |
| 131 | +{ | |
| 132 | + return (a.m_energy <= b.m_energy); | |
| 133 | +} | |
| 134 | +inline | |
| 135 | +bool operator> (const GEnergy &a, const GEnergy &b) | |
| 136 | +{ | |
| 137 | + return (a.m_energy > b.m_energy); | |
| 138 | +} | |
| 139 | +inline | |
| 140 | +bool operator>= (const GEnergy &a, const GEnergy &b) | |
| 141 | +{ | |
| 142 | + return (a.m_energy >= b.m_energy); | |
| 143 | +} | |
| 120 | 144 | |
| 121 | 145 | #endif /* GENERGY_HPP */ | ... | ... |