comparison operators that makes sense
This commit is contained in:
parent
8e50d9292d
commit
04eb87ed82
|
@ -90,30 +90,41 @@ bool operator== (const data_header& a, const data_header& b)
|
|||
|
||||
|
||||
/**
|
||||
* @brief For matching universe numbers, lower priorities are lesser.
|
||||
* @brief operator <
|
||||
* @param a
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
bool operator< (const data_header& a, const data_header& b)
|
||||
{
|
||||
return (a.source_name == b.source_name &&
|
||||
a.universe == b.universe &&
|
||||
a.priority < b.priority);
|
||||
if (a == b)
|
||||
return false;
|
||||
|
||||
if (a.universe != b.universe)
|
||||
return a.universe < b.universe;
|
||||
|
||||
if (a.priority != b.priority)
|
||||
return a.priority < b.priority;
|
||||
|
||||
if (a.source_name != b.source_name)
|
||||
return a.source_name < b.source_name;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief For matching universe numbers, higher priorities are greater.
|
||||
* @brief operator >
|
||||
* @param a
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
bool operator> (const data_header& a, const data_header& b)
|
||||
{
|
||||
return (a.source_name == b.source_name &&
|
||||
a.universe == b.universe &&
|
||||
a.priority > b.priority);
|
||||
if (a == b)
|
||||
return false;
|
||||
|
||||
return !(a < b);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue