Class StreamRange<T> (2.23.0-rc)

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";
  }
}

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