Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
Fix unstable erase.
Browse files Browse the repository at this point in the history
  • Loading branch information
CPWstatic committed Mar 8, 2021
1 parent c656c2a commit 83181cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
3 changes: 2 additions & 1 deletion src/context/Iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ void SequentialIter::erase() {
}

void SequentialIter::unstableErase() {
erase();
std::swap(rows_->back(), *iter_);
rows_->pop_back();
}

void SequentialIter::eraseRange(size_t first, size_t last) {
Expand Down
42 changes: 0 additions & 42 deletions src/context/Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,48 +371,6 @@ class GetNeighborsIter final : public Iterator {

class SequentialIter final : public Iterator {
public:
class SeqLogicalRow final : public LogicalRow {
public:
explicit SeqLogicalRow(const Row* row) : LogicalRow({row}) {}

SeqLogicalRow(const SeqLogicalRow &r) = default;
SeqLogicalRow& operator=(const SeqLogicalRow &r) = default;

SeqLogicalRow(SeqLogicalRow &&r) noexcept {
*this = std::move(r);
}
SeqLogicalRow& operator=(SeqLogicalRow &&r) noexcept {
segments_ = std::move(r.segments_);
return *this;
}

const Value& operator[](size_t idx) const override {
DCHECK_EQ(segments_.size(), 1);
auto* row = segments_[0];
if (idx < row->size()) {
return row->values[idx];
}
return Value::kEmpty;
}

size_t size() const override {
DCHECK_EQ(segments_.size(), 1);
auto* row = segments_[0];
return row->size();
}

LogicalRow::Kind kind() const override {
return Kind::kSequential;
}

const std::vector<const Row*>& segments() const override {
return segments_;
}

private:
friend class SequentialIter;
};

explicit SequentialIter(std::shared_ptr<Value> value);

// Union multiple sequential iterators
Expand Down

0 comments on commit 83181cb

Please sign in to comment.