Remove copy constructor/assignment from SkipList accessors

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2230
This commit is contained in:
Matej Ferencevic 2019-08-06 10:45:19 +02:00
parent 3a95a3c29d
commit bad1f8b525
2 changed files with 8 additions and 14 deletions

View File

@ -365,7 +365,7 @@ void LabelIndex::Iterable::Iterator::AdvanceUntilValid() {
LabelIndex::Iterable::Iterable(utils::SkipList<Entry>::Accessor index_accessor, LabelIndex::Iterable::Iterable(utils::SkipList<Entry>::Accessor index_accessor,
LabelId label, View view, LabelId label, View view,
Transaction *transaction, Indices *indices) Transaction *transaction, Indices *indices)
: index_accessor_(index_accessor), : index_accessor_(std::move(index_accessor)),
label_(label), label_(label),
view_(view), view_(view),
transaction_(transaction), transaction_(transaction),
@ -550,7 +550,7 @@ LabelPropertyIndex::Iterable::Iterable(
const std::optional<utils::Bound<PropertyValue>> &lower_bound, const std::optional<utils::Bound<PropertyValue>> &lower_bound,
const std::optional<utils::Bound<PropertyValue>> &upper_bound, View view, const std::optional<utils::Bound<PropertyValue>> &upper_bound, View view,
Transaction *transaction, Indices *indices) Transaction *transaction, Indices *indices)
: index_accessor_(index_accessor), : index_accessor_(std::move(index_accessor)),
label_(label), label_(label),
property_(property), property_(property),
lower_bound_(lower_bound), lower_bound_(lower_bound),

View File

@ -575,16 +575,13 @@ class SkipList final {
if (skiplist_ != nullptr) skiplist_->gc_.ReleaseId(id_); if (skiplist_ != nullptr) skiplist_->gc_.ReleaseId(id_);
} }
Accessor(const Accessor &other) Accessor(const Accessor &) = delete;
: skiplist_(other.skiplist_), id_(skiplist_->gc_.AllocateId()) {} Accessor &operator=(const Accessor &) = delete;
Accessor(Accessor &&other) noexcept Accessor(Accessor &&other) noexcept
: skiplist_(other.skiplist_), id_(other.id_) { : skiplist_(other.skiplist_), id_(other.id_) {
other.skiplist_ = nullptr; other.skiplist_ = nullptr;
} }
Accessor &operator=(const Accessor &other) {
skiplist_ = other.skiplist_;
id_ = skiplist_->gc_.AllocateId();
}
Accessor &operator=(Accessor &&other) noexcept { Accessor &operator=(Accessor &&other) noexcept {
skiplist_ = other.skiplist_; skiplist_ = other.skiplist_;
id_ = other.id_; id_ = other.id_;
@ -716,16 +713,13 @@ class SkipList final {
if (skiplist_ != nullptr) skiplist_->gc_.ReleaseId(id_); if (skiplist_ != nullptr) skiplist_->gc_.ReleaseId(id_);
} }
ConstAccessor(const ConstAccessor &other) ConstAccessor(const ConstAccessor &) = delete;
: skiplist_(other.skiplist_), id_(skiplist_->gc_.AllocateId()) {} ConstAccessor &operator=(const ConstAccessor &) = delete;
ConstAccessor(ConstAccessor &&other) noexcept ConstAccessor(ConstAccessor &&other) noexcept
: skiplist_(other.skiplist_), id_(other.id_) { : skiplist_(other.skiplist_), id_(other.id_) {
other.skiplist_ = nullptr; other.skiplist_ = nullptr;
} }
ConstAccessor &operator=(const ConstAccessor &other) {
skiplist_ = other.skiplist_;
id_ = skiplist_->gc_.AllocateId();
}
ConstAccessor &operator=(ConstAccessor &&other) noexcept { ConstAccessor &operator=(ConstAccessor &&other) noexcept {
skiplist_ = other.skiplist_; skiplist_ = other.skiplist_;
id_ = other.id_; id_ = other.id_;