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";
}
}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["\u003cp\u003eThe webpage details the \u003ccode\u003eStreamRange<T>\u003c/code\u003e class, which represents a range of \u003ccode\u003eStatusOr<T>\u003c/code\u003e values, with a non-OK \u003ccode\u003eStatus\u003c/code\u003e indicating the end of the stream.\u003c/p\u003e\n"],["\u003cp\u003eCallers can iterate through the \u003ccode\u003eStreamRange<T>\u003c/code\u003e using its \u003ccode\u003ebegin()\u003c/code\u003e and \u003ccode\u003eend()\u003c/code\u003e members, enabling the use of standard C++ constructs and algorithms designed for Input Iterators.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eStreamRange\u003c/code\u003e can be utilized with many versions of the library, from 2.10.1 up to 2.37.0-rc, all of which are referenced through links.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides a default constructor to make an empty range, and move/copy assignment and constructors to duplicate existing ranges.\u003c/p\u003e\n"],["\u003cp\u003eThe range can be used with a \u003ccode\u003efor\u003c/code\u003e loop to iterate through the values, and an example of using a range of integers is provided.\u003c/p\u003e\n"]]],[],null,[]]