Class StreamRange<T> (2.46.0-rc)

AStreamRange<T> is a range ofStatusOr<T> where the end-of-stream is indicated by a non-OKStatus.

Callers can iterate the range using itsbegin() andend() members to access iterators that will work with any normal C++ constructs and algorithms that acceptInput 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 aStreamRange<T> for testing (e.g. to mock aConnection::ListFoo call), seegoogle::cloud::mocks::MakeStreamRange.

Constructors

StreamRange(StreamRange const &)

Move-only

Parameter
NameDescription
StreamRange const &

StreamRange(StreamRange &&)

Move-only

Parameter
NameDescription
StreamRange &&

StreamRange()

Default-constructs an empty range.

Operators

operator=(StreamRange const &)

Move-only

Parameter
NameDescription
StreamRange const &
Returns
TypeDescription
StreamRange &

operator=(StreamRange &&)

Move-only

Parameter
NameDescription
StreamRange &&
Returns
TypeDescription
StreamRange &

Functions

begin()

Returns
TypeDescription
iterator

end()

Returns
TypeDescription
iterator

Type Aliases

value_type

Alias Of:StatusOr< T >

iterator

Alias Of:IteratorImpl< value_type >

difference_type

Alias Of:typename iterator::difference_type

reference

Alias Of:typename iterator::reference

pointer

Alias Of:typename iterator::pointer

const_reference

Alias Of:typename iterator::const_reference

const_pointer

Alias Of:typename iterator::const_pointer

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.