Skip to content

Commit

Permalink
UUIDValueに三方比較演算子を実装 #658
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsurom committed Oct 1, 2021
1 parent 300056e commit 1cadc8a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Siv3D/include/Siv3D/UUIDValue.hpp
Expand Up @@ -11,6 +11,9 @@

# pragma once
# include <array>
# if __has_include(<compare>)
# include <compare>
# endif
# include "Common.hpp"
# include "StringView.hpp"
# include "Optional.hpp"
Expand Down Expand Up @@ -77,6 +80,13 @@ namespace s3d
[[nodiscard]]
size_t hash() const noexcept;

#if __cpp_impl_three_way_comparison

[[nodiscard]]
std::strong_ordering operator <=>(const UUIDValue& rhs) const noexcept = default;

#else

[[nodiscard]]
friend bool operator ==(const UUIDValue& lhs, const UUIDValue& rhs) noexcept
{
Expand All @@ -95,6 +105,8 @@ namespace s3d
return (lhs.m_data < rhs.m_data);
}

#endif

[[nodiscard]]
static UUIDValue Generate();

Expand Down

0 comments on commit 1cadc8a

Please sign in to comment.