Appends a source location and returns an rvalue reference to *this.
Declared in <absl/status/statusor.h>
[[nodiscard]]
StatusOr<T>&&
WithSourceLocation(absl::SourceLocation loc = absl::SourceLocation::current()) &&;
Appends the loc to the current location chain inside the status iff the status-or is non-ok and contains a non-empty message, and returns an rvalue reference to *this.
Example:
StatusOr<int> Finalize(...);
StatusOr<int> DoSomething(...) { ... return Finalize().WithSourceLocation(); }
| Name | Description |
|---|---|
| loc | The source location to append. |