Class StreamRange<T> (2.16.0)

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
Name
Description
StreamRange const &

StreamRange(StreamRange &&)

Move-only

Parameter
Name
Description
StreamRange &&

StreamRange()

Default-constructs an empty range.

Operators

operator=(StreamRange const &)

Move-only

Parameter
Name
Description
StreamRange const &
Returns
Type
Description
StreamRange &

operator=(StreamRange &&)

Move-only

Parameter
Name
Description
StreamRange &&
Returns
Type
Description
StreamRange &

Functions

begin()

Returns
Type
Description
iterator

end()

Returns
Type
Description
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
Create a Mobile Website
View Site in Mobile | Classic
Share by: