aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/deep.h3
-rw-r--r--src/uniquekey.h11
2 files changed, 7 insertions, 7 deletions
diff --git a/src/deep.h b/src/deep.h
index e15f07b..b39a87f 100644
--- a/src/deep.h
+++ b/src/deep.h
@@ -22,6 +22,7 @@ extern "C"
22 22
23// forwards 23// forwards
24enum class LookupMode; 24enum class LookupMode;
25class DeepFactory;
25class Universe; 26class Universe;
26 27
27// ################################################################################################# 28// #################################################################################################
@@ -35,7 +36,7 @@ struct DeepPrelude
35{ 36{
36 UniqueKey const magic{ kDeepVersion }; 37 UniqueKey const magic{ kDeepVersion };
37 // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the factory 38 // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the factory
38 class DeepFactory& factory; 39 DeepFactory& factory;
39 // data is destroyed when refcount is 0 40 // data is destroyed when refcount is 0
40 std::atomic<int> refcount{ 0 }; 41 std::atomic<int> refcount{ 0 };
41 42
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 }