diff --git a/fdbclient/VersionedMap.h b/fdbclient/VersionedMap.h index ce7a2159c8..4f78cb93e6 100644 --- a/fdbclient/VersionedMap.h +++ b/fdbclient/VersionedMap.h @@ -91,6 +91,22 @@ namespace PTreeImpl { public: PTreeFinger() {} + // Explicit copy constructors ensure we copy the live values in entries_. + PTreeFinger(PTreeFinger const& f) { *this = f; } + PTreeFinger(PTreeFinger&& f) { *this = f; } + + PTreeFinger& operator=(PTreeFinger const& f) { + size_ = f.size_; + std::copy(f.entries_, f.entries_ + size_, entries_); + return *this; + } + + PTreeFinger& operator=(PTreeFinger&& f) { + size_ = std::exchange(f.size_, 0); + std::copy(f.entries_, f.entries_ + size_, entries_); + return *this; + } + size_t size() const { return size_; } void push_back(PTree const* node) { this->push_back(node, false); } PTree const* back() const { return entries_[size_ - 1].node; }