Some fixes

Build fix in foreign_object.hpp
Wrong assert when a module contains
more than one class, dynafunc_maker.cpp
This commit is contained in:
King_DuckZ 2024-05-26 20:36:31 +02:00
parent 60a9392386
commit d2a1187ad5
2 changed files with 6 additions and 4 deletions

View file

@ -28,8 +28,13 @@ public:
ForeignObject() = default; ForeignObject() = default;
ForeignObject (std::nullptr_t) : ForeignObject() {} ForeignObject (std::nullptr_t) : ForeignObject() {}
ForeignObject (T* obj, Handle&& handle); ForeignObject (T* obj, Handle&& handle);
ForeignObject (ForeignObject&&) = default;
~ForeignObject() noexcept = 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); void set_to_slot (int num);
T& object() { return *m_object; } T& object() { return *m_object; }
const T& object() const { return *m_object; } const T& object() const { return *m_object; }
@ -41,8 +46,6 @@ public:
operator const T&() const { return object(); } operator const T&() const { return object(); }
operator Handle&() { return handle(); } operator Handle&() { return handle(); }
operator const Handle&() const { 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: private:
Handle m_handle; Handle m_handle;

View file

@ -111,8 +111,7 @@ namespace wren {
); );
const CharVec* source_mem; const CharVec* source_mem;
if (dst.cend() != it_found) { if (dst.cend() != it_found && std::equal(it_found->cbegin(), it_found->cend(), new_entry.cbegin(), new_entry.cend())) {
assert(std::equal(it_found->cbegin(), it_found->cend(), new_entry.cbegin(), new_entry.cend()));
source_mem = &*it_found; source_mem = &*it_found;
} }
else { else {