diff --git a/list.hpp b/list.hpp index 934c56ce..fdde4c62 100644 --- a/list.hpp +++ b/list.hpp @@ -27,7 +27,7 @@ namespace realm { public: List(SharedRealm &r, const ObjectSchema &s, LinkViewRef l) : m_realm(r), object_schema(s), m_link_view(l) {} - const ObjectSchema object_schema; + const ObjectSchema &object_schema; SharedRealm realm() { return m_realm; } size_t size(); diff --git a/object_accessor.hpp b/object_accessor.hpp index 5d290d43..ae1025f0 100644 --- a/object_accessor.hpp +++ b/object_accessor.hpp @@ -27,7 +27,7 @@ namespace realm { template static inline Object create(ContextType ctx, SharedRealm realm, const ObjectSchema &object_schema, ValueType value, bool try_update); - const ObjectSchema object_schema; + const ObjectSchema &object_schema; SharedRealm realm() { return m_realm; } Row row() { return m_row; } diff --git a/results.cpp b/results.cpp index 2f466476..e879c6b7 100644 --- a/results.cpp +++ b/results.cpp @@ -38,6 +38,15 @@ Results::Results(SharedRealm r, const ObjectSchema &o, Table& table) { } +Results& Results::operator=(Results const& r) +{ + m_realm = r.m_realm; + const_cast(object_schema) = r.object_schema; + m_query = r.get_query(); + m_sort = r.get_sort(); + return *this; +} + void Results::validate_read() const { if (m_realm) diff --git a/results.hpp b/results.hpp index 53ee6815..115ca636 100644 --- a/results.hpp +++ b/results.hpp @@ -38,14 +38,14 @@ public: // Results is copyable and moveable Results(Results const&) = default; Results(Results&&) = default; - Results& operator=(Results const&) = default; Results& operator=(Results&&) = default; + Results& operator=(Results const&); // Get the Realm SharedRealm get_realm() const { return m_realm; } // Object schema describing the vendored object type - ObjectSchema object_schema; + const ObjectSchema &object_schema; // Get a query which will match the same rows as is contained in this Results // Returned query will not be valid if the current mode is Empty