Skip to content

Commit

Permalink
Make Tuple::pack return a Standalone<StringRef> (#7764)
Browse files Browse the repository at this point in the history
This makes it less error-prone and more like other similar functions
like BinaryWriter::toValue

Closes #7748
  • Loading branch information
sfc-gh-anoyes committed Aug 2, 2022
1 parent 48e46cb commit 5dbb6f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bindings/flow/Tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ struct Tuple {
Tuple& appendNull();
Tuple& appendVersionstamp(Versionstamp const&);

StringRef pack() const { return StringRef(data.begin(), data.size()); }
Standalone<StringRef> pack() const {
return Standalone<StringRef>(StringRef(data.begin(), data.size()), data.arena());
}

template <typename T>
Tuple& operator<<(T const& t) {
Expand Down
4 changes: 3 additions & 1 deletion fdbclient/include/fdbclient/Tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ struct Tuple {
Tuple& appendNull();
Tuple& append(Versionstamp const&);

StringRef pack() const { return StringRef(data.begin(), data.size()); }
Standalone<StringRef> pack() const {
return Standalone<StringRef>(StringRef(data.begin(), data.size()), data.arena());
}

template <typename T>
Tuple& operator<<(T const& t) {
Expand Down

0 comments on commit 5dbb6f1

Please sign in to comment.