diff --git a/src/list.cpp b/src/list.cpp index 747f5eae..6ad8a59e 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -18,10 +18,21 @@ #include "list.hpp" +#include "shared_realm.hpp" + #include using namespace realm; +List::List(std::shared_ptr r, const ObjectSchema& s, LinkViewRef l) +: m_realm(std::move(r)) +, m_object_schema(&s) +, m_link_view(std::move(l)) +{ +} + +List::~List() = default; + size_t List::size() { verify_attached(); diff --git a/src/list.hpp b/src/list.hpp index 99600d1f..d134162e 100644 --- a/src/list.hpp +++ b/src/list.hpp @@ -19,22 +19,21 @@ #ifndef REALM_LIST_HPP #define REALM_LIST_HPP -#include "shared_realm.hpp" #include +#include + namespace realm { class ObjectSchema; +class Realm; + class List { public: - List(SharedRealm& r, const ObjectSchema& s, LinkViewRef l) - : m_realm(r) - , m_object_schema(&s) - , m_link_view(l) - { - } + List(std::shared_ptr r, const ObjectSchema& s, LinkViewRef l); + ~List(); const ObjectSchema& get_object_schema() const { return *m_object_schema; } - SharedRealm realm() { return m_realm; } + const std::shared_ptr& realm() { return m_realm; } size_t size(); Row get(std::size_t row_ndx); @@ -60,7 +59,7 @@ public: void verify_in_tranaction(); private: - SharedRealm m_realm; + std::shared_ptr m_realm; const ObjectSchema* m_object_schema; LinkViewRef m_link_view; };