A StreamRange
<T>
is a range of StatusOr
<T>
where the end-of-stream is indicated by a non-OK Status
.
Callers can iterate the range using its begin()
and end()
members to access iterators that will work with any normal C++ constructs and algorithms that accept Input Iterators
.
Callers should only consume/iterate this range.
Example: Iterating a range of 10 integers
// Some function that returns a StreamRange<int>
StreamRange<int> MakeRangeFromOneTo(int n);
StreamRange<int> sr = MakeRangeFromOneTo(10);
for (StatusOr<int> const& x : sr) {
if (!x) {
std::cerr << "Fail: " << x.status() << "\n";
} else {
std::cout << *x << "\n";
}
}
Note:To construct a
StreamRange<T>for testing (e.g. to mock aConnection::ListFoocall), seegoogle::cloud::mocks::MakeStreamRange.
Constructors
StreamRange
StreamRange const &
StreamRange
StreamRange &&
StreamRange
Default-constructs an empty range.
~StreamRange
Operators
operator=
StreamRange const &
StreamRange &
operator=
StreamRange &&
StreamRange &
Functions
begin
iterator
end
iterator

