Class google::cloud::StreamRange (2.10.1)

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 a Connection::ListFoo call), see google::cloud::mocks::MakeStreamRange.

Constructors

StreamRange

Parameter
Name Description
StreamRange const &

StreamRange

Parameter
Name Description
StreamRange &&

StreamRange

Default-constructs an empty range.

~StreamRange

Operators

operator=

Parameter
Name Description
StreamRange const &
Returns
Type Description
StreamRange &

operator=

Parameter
Name Description
StreamRange &&
Returns
Type Description
StreamRange &

Functions

begin

Returns
Type Description
iterator

end

Returns
Type Description
iterator