diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-12-09 14:58:28 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-12-09 14:58:28 +0000 |
commit | 438129e8b3bf490226e19b6d9c09261024c126fd (patch) | |
tree | a13d9b9c41bbe2bf758e64550fbb765c7750edc3 | |
parent | 136e428e41823454c7f09044277db05ea96168b3 (diff) |
Also set `DocumentUpdate::_repo` in non-rvalue init function
-rw-r--r-- | document/src/vespa/document/update/documentupdate.cpp | 8 | ||||
-rw-r--r-- | document/src/vespa/document/update/documentupdate.h | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp index d6488c1381c..6ab01a4d3ff 100644 --- a/document/src/vespa/document/update/documentupdate.cpp +++ b/document/src/vespa/document/update/documentupdate.cpp @@ -87,15 +87,10 @@ DocumentUpdate::operator==(const DocumentUpdate& other) const } const DocumentType& -DocumentUpdate::getType() const { +DocumentUpdate::getType() const noexcept { return static_cast<const DocumentType &> (*_type); } -const DocumentTypeRepo* -DocumentUpdate::getRepoPtr() const noexcept { - return _repo; -} - const DocumentUpdate::FieldUpdateV & DocumentUpdate::getUpdates() const { ensureDeserialized(); @@ -266,6 +261,7 @@ DocumentUpdate::initHEAD(const DocumentTypeRepo & repo, vespalib::nbostream && s void DocumentUpdate::initHEAD(const DocumentTypeRepo & repo, vespalib::nbostream & stream) { + _repo = &repo; size_t startPos = stream.rp(); vespalib::stringref docId; _type = deserializeHeader(repo, stream, docId); diff --git a/document/src/vespa/document/update/documentupdate.h b/document/src/vespa/document/update/documentupdate.h index 5a7944b1188..d554e66bd1a 100644 --- a/document/src/vespa/document/update/documentupdate.h +++ b/document/src/vespa/document/update/documentupdate.h @@ -99,10 +99,12 @@ public: void eagerDeserialize() const; /** @return The type of document this update is for. */ - const DocumentType& getType() const; + const DocumentType& getType() const noexcept; // Returns pointer to repo used for underlying update, or nullptr if default-constructed - const DocumentTypeRepo* getRepoPtr() const noexcept; + const DocumentTypeRepo* getRepoPtr() const noexcept { + return _repo; + } void serializeHEAD(vespalib::nbostream &stream) const; |