From d2a1187ad5a355ecfc9a6d0ec52cfccff0b02658 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sun, 26 May 2024 20:36:31 +0200 Subject: [PATCH] Some fixes Build fix in foreign_object.hpp Wrong assert when a module contains more than one class, dynafunc_maker.cpp --- include/wrenpp/detail/foreign_object.hpp | 7 +++++-- src/dynafunc_maker.cpp | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/wrenpp/detail/foreign_object.hpp b/include/wrenpp/detail/foreign_object.hpp index 6c7e78a..898fcaa 100644 --- a/include/wrenpp/detail/foreign_object.hpp +++ b/include/wrenpp/detail/foreign_object.hpp @@ -28,8 +28,13 @@ public: ForeignObject() = default; ForeignObject (std::nullptr_t) : ForeignObject() {} ForeignObject (T* obj, Handle&& handle); + ForeignObject (ForeignObject&&) = default; ~ForeignObject() noexcept = default; + ForeignObject& operator= (ForeignObject&&) = default; + bool operator!= (std::nullptr_t) const { return nullptr != m_object; } + bool operator== (std::nullptr_t) const { return nullptr == m_object; } + void set_to_slot (int num); T& object() { return *m_object; } const T& object() const { return *m_object; } @@ -41,8 +46,6 @@ public: operator const T&() const { return object(); } operator Handle&() { return handle(); } operator const Handle&() const { return handle(); } - bool operator!= (std::nullptr_t) const { return nullptr != m_object; } - bool operator== (std::nullptr_t) const { return nullptr == m_object; } private: Handle m_handle; diff --git a/src/dynafunc_maker.cpp b/src/dynafunc_maker.cpp index 18b7310..6e3ecd8 100644 --- a/src/dynafunc_maker.cpp +++ b/src/dynafunc_maker.cpp @@ -111,8 +111,7 @@ namespace wren { ); const CharVec* source_mem; - if (dst.cend() != it_found) { - assert(std::equal(it_found->cbegin(), it_found->cend(), new_entry.cbegin(), new_entry.cend())); + if (dst.cend() != it_found && std::equal(it_found->cbegin(), it_found->cend(), new_entry.cbegin(), new_entry.cend())) { source_mem = &*it_found; } else {