aboutsummaryrefslogtreecommitdiff
path: root/src/uniquekey.h
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-06-03 16:53:50 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-06-03 16:53:50 +0200
commit09635e063c007c4bda684ee21abb55c7470ee0e0 (patch)
tree73cb52d8140c19dc11e6ae427eea260bb21c55ff /src/uniquekey.h
parent44c617f7b756052c7cd059c96f89b85f0f5ec96c (diff)
downloadlanes-09635e063c007c4bda684ee21abb55c7470ee0e0.tar.gz
lanes-09635e063c007c4bda684ee21abb55c7470ee0e0.tar.bz2
lanes-09635e063c007c4bda684ee21abb55c7470ee0e0.zip
Code boyscouting
Diffstat (limited to '')
-rw-r--r--src/uniquekey.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/uniquekey.h b/src/uniquekey.h
index 7e86cbe..5ccecc5 100644
--- a/src/uniquekey.h
+++ b/src/uniquekey.h
@@ -9,10 +9,8 @@
9 9
10class UniqueKey 10class UniqueKey
11{ 11{
12 protected:
13 uintptr_t const storage{ 0 };
14
15 public: 12 public:
13 uintptr_t const storage{ 0 };
16 std::string_view debugName{}; 14 std::string_view debugName{};
17 15
18 // --------------------------------------------------------------------------------------------- 16 // ---------------------------------------------------------------------------------------------
@@ -27,10 +25,11 @@ class UniqueKey
27 } 25 }
28 // --------------------------------------------------------------------------------------------- 26 // ---------------------------------------------------------------------------------------------
29 constexpr UniqueKey(UniqueKey const& rhs_) = default; 27 constexpr UniqueKey(UniqueKey const& rhs_) = default;
28 // debugName is irrelevant in comparisons
29 inline constexpr std::weak_ordering operator<=>(UniqueKey const& rhs_) const { return storage <=> rhs_.storage; }
30 inline constexpr auto operator==(UniqueKey const& rhs_) const { return storage == rhs_.storage; }
30 // --------------------------------------------------------------------------------------------- 31 // ---------------------------------------------------------------------------------------------
31 constexpr std::strong_ordering operator<=>(UniqueKey const& rhs_) const = default; 32 bool equals(lua_State* const L_, int const i_) const
32 // ---------------------------------------------------------------------------------------------
33 bool equals(lua_State* const L_, int i_) const
34 { 33 {
35 return lua_touserdata(L_, i_) == std::bit_cast<void*>(storage); 34 return lua_touserdata(L_, i_) == std::bit_cast<void*>(storage);
36 } 35 }