3
0
Fork 0
forked from suyu/suyu

Merge pull request #6684 from ogniK5377/uuid-cpp20-new

uuid: Directly compare UUID instead of checking per element
This commit is contained in:
Morph 2021-07-20 13:44:48 -04:00 committed by GitHub
commit 8616c0f8f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,12 +20,11 @@ struct UUID {
constexpr explicit UUID(const u64 lo, const u64 hi) : uuid{{lo, hi}} {}
[[nodiscard]] constexpr explicit operator bool() const {
return uuid[0] != INVALID_UUID[0] && uuid[1] != INVALID_UUID[1];
return uuid != INVALID_UUID;
}
[[nodiscard]] constexpr bool operator==(const UUID& rhs) const {
// TODO(DarkLordZach): Replace with uuid == rhs.uuid with C++20
return uuid[0] == rhs.uuid[0] && uuid[1] == rhs.uuid[1];
return uuid == rhs.uuid;
}
[[nodiscard]] constexpr bool operator!=(const UUID& rhs) const {