Remove move constructor and delete move =

Reviewers: florijan, mislav.bradac

Reviewed By: mislav.bradac

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D237
This commit is contained in:
Dominik Gleich 2017-04-06 14:14:19 +02:00
parent e5c814e022
commit e8fe25bc61

View File

@ -35,15 +35,13 @@ class VersionList {
VersionList() = delete; VersionList() = delete;
VersionList(const VersionList &) = delete; VersionList(const VersionList &) = delete;
VersionList &operator=(const VersionList &) = delete; VersionList &operator=(const VersionList &) = delete;
// We do a lot of raw-pointer ops with VLists, and these ops assume that a
/* @brief Move constructs the version list // VList's address identifies a vertex/edge absolutely and during it's whole
* Note: use only at the beginning of the "other's" lifecycle since this // lifteme. We also assume that the VList owner is the database and that
* constructor doesn't move the RecordLock, but only the head pointer // ownership is also handled via raw pointers so this shouldn't be moved or
*/ // move assigned.
VersionList(VersionList &&other) { VersionList(const VersionList &&other) = delete;
this->head = other.head.load(); VersionList &operator=(const VersionList &&other) = delete;
other.head = nullptr;
}
~VersionList() { delete head.load(); } ~VersionList() { delete head.load(); }
@ -154,8 +152,7 @@ class VersionList {
new_ref = nullptr; new_ref = nullptr;
old_ref = head.load(std::memory_order_seq_cst); old_ref = head.load(std::memory_order_seq_cst);
while (old_ref != nullptr && !old_ref->visible(t)) { while (old_ref != nullptr && !old_ref->visible(t)) {
if (!new_ref && old_ref->is_created_by(t)) if (!new_ref && old_ref->is_created_by(t)) new_ref = old_ref;
new_ref = old_ref;
old_ref = old_ref->next(std::memory_order_seq_cst); old_ref = old_ref->next(std::memory_order_seq_cst);
} }
} }