bkietz commented on code in PR #13304:
URL: https://github.com/apache/arrow/pull/13304#discussion_r890388327
##########
cpp/src/arrow/status.h:
##########
@@ -424,6 +426,22 @@ Status Status::operator&(Status&& s) const noexcept {
}
}
+Status Status::operator&&(const Status& s) const noexcept {
+ if (ok()) {
+ return s;
+ } else {
+ return *this;
+ }
+}
+
+Status Status::operator&&(Status&& s) const noexcept {
Review Comment:
I agree that having a non-reference parameter is preferable. We might still
want two overloads, however, since we're copying in the case that `*this` is
not ok:
```c++
Status Status::operator&&(Status s) const& noexcept {
if (!ok()) return *this;
return s;
}
Status Status::operator&&(Status s) && noexcept {
if (!ok()) return std::move(*this);
return s;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]