1
0
Fork 0

less than operator overloads

This commit is contained in:
Kevin Matz 2021-09-04 17:37:58 -04:00
parent 7a1bcd74ca
commit 777732e378
4 changed files with 31 additions and 0 deletions

View File

@ -194,6 +194,22 @@ bool operator== (const discoveredUniverse& a, const discoveredUniverse& b)
a.source == b.source);
}
/**
* @brief operator <
* @param a
* @param b
* @return
*/
bool operator< (const discoveredUniverse& a, const discoveredUniverse& b)
{
if (a.universe != b.universe)
return (a.universe < b.universe);
return a.source < b.source;
}
} // DISCOVERY
} // EXTENDED
} // SACN

View File

@ -146,6 +146,8 @@ struct discoveredUniverse
friend bool operator== (const discoveredUniverse& a,
const discoveredUniverse& b);
friend bool operator< (const discoveredUniverse& a,
const discoveredUniverse& b);
};

View File

@ -431,6 +431,18 @@ bool operator== (const uuid& a, const uuid& b)
}
/**
* @brief operator <
* @param a
* @param b
* @return
*/
bool operator< (const uuid& a, const uuid& b)
{
return (std::memcmp(a.raw_, b.raw_, UUID_LENGTH) < 0);
}
/**
* @brief uuid::operator const uint8_t *
*/

View File

@ -149,6 +149,7 @@ public:
// operator overloads
uuid& operator= (const uuid& other);
friend bool operator== (const uuid&, const uuid&);
friend bool operator< (const uuid&, const uuid&);
// typecast overload
operator const uint8_t * () const;