From 37b8e34dc54f572fbfbd135742fa11c21c5e67c1 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 11 Dec 2025 13:25:12 +0100 Subject: chore! breaking changes in NeCTI API. Signed-off-by: Amlal El Mahrouss --- include/CompilerKit/Ref.h | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'include/CompilerKit/Ref.h') diff --git a/include/CompilerKit/Ref.h b/include/CompilerKit/Ref.h index d9b0593..c104a81 100644 --- a/include/CompilerKit/Ref.h +++ b/include/CompilerKit/Ref.h @@ -28,28 +28,27 @@ class StrongRef { } } - NECTI_COPY_DELETE(StrongRef) - NECTI_MOVE_DEFAULT(StrongRef) + NECTI_COPY_DEFAULT(StrongRef) using Type = T; protected: - explicit StrongRef(Type* cls, const bool strong) : m_Class(cls), m_Strong(strong) {} + StrongRef(Type* cls, const bool strong) : m_Class(cls), m_Strong(strong) {} public: - explicit StrongRef(Type* cls) : m_Class(cls), m_Strong(true) {} + StrongRef(Type* cls) : m_Class(cls), m_Strong(true) {} - StrongRef& operator=(Type ref) { - *m_Class = ref; + StrongRef& operator=(Type *ref) { + m_Class = ref; return *this; } public: Type* operator->() const { return m_Class; } - Type& Leak() { return *m_Class; } + Type* Leak() { return m_Class; } - Type operator*() { return *m_Class; } + Type* operator*() { return m_Class; } bool IsStrong() const { return m_Strong; } @@ -61,19 +60,17 @@ class StrongRef { }; template -class WeakRef final : StrongRef { +class WeakRef final : public StrongRef { public: - WeakRef() = default; - + WeakRef() = delete; ~WeakRef() = default; - NECTI_COPY_DELETE(WeakRef) - NECTI_MOVE_DEFAULT(WeakRef) + NECTI_COPY_DEFAULT(WeakRef) public: using Type = T; - explicit WeakRef(Type* cls) : StrongRef(cls, false) {} + WeakRef(Type* cls) : StrongRef(cls, false) {} }; /// @author Amlal El Mahrouss @@ -82,7 +79,7 @@ template class NonNullRef final { public: explicit NonNullRef() = delete; - explicit NonNullRef(Type* ref) : m_Ref(ref, true) {} + NonNullRef(Type* ref) : m_Ref(ref, true) {} StrongRef& operator->() { MUST_PASS(m_Ref); -- cgit v1.2.3