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 {