Couchbase C++ SDK 1.4.0 (rev. 59aa900)
Loading...
Searching...
No Matches
analytics_stream_result::iterator Class Reference

A single-pass input iterator that synchronously fetches rows one at a time. More...

#include <couchbase/analytics_stream_result.hxx>

Public Member Functions

auto operator* () const -> std::pair< error, analytics_row >
auto operator++ () -> iterator &
 iterator (std::shared_ptr< internal_analytics_stream_result > internal)
 Constructs an iterator over an internal result; prefer begin().

Friends

auto operator== (const iterator &it, end_sentinel) -> bool
 Compares an iterator against the end sentinel.
auto operator== (end_sentinel end, const iterator &it) -> bool
auto operator!= (const iterator &it, end_sentinel end) -> bool
auto operator!= (end_sentinel end, const iterator &it) -> bool

Detailed Description

A single-pass input iterator that synchronously fetches rows one at a time.

Dereferencing yields std::pair<error, analytics_row>: for a data row the error is falsy; if the stream ends with an error, the iterator visits exactly one final element whose error is truthy (and whose row is empty) before comparing equal to end(). A clean end-of-stream yields no such element. This guarantees a for (auto [err, row] : result) loop can observe a terminal error rather than silently stopping.

This is a minimal single-pass iterator intended for range-based for and manual while (it != result.end()) loops. It compares only against end() (never against another iterator), and provides neither operator-> nor post-increment, so it is deliberately not a LegacyInputIterator and does not work with <algorithm> or std::distance. begin() must be called once.

Since
1.4.0
Volatile
Should not be used in production

Constructor & Destructor Documentation

◆ iterator()

iterator ( std::shared_ptr< internal_analytics_stream_result > internal)
explicit

Constructs an iterator over an internal result; prefer begin().

Since
1.4.0
Internal
Internal interface

Member Function Documentation

◆ operator*()

auto operator* ( ) const -> std::pair< error, analytics_row >

◆ operator++()

auto operator++ ( ) -> iterator &

◆ operator!= [1/2]

auto operator!= ( const iterator & it,
end_sentinel end ) -> bool
friend

◆ operator!= [2/2]

auto operator!= ( end_sentinel end,
const iterator & it ) -> bool
friend

◆ operator== [1/2]

auto operator== ( const iterator & it,
end_sentinel  ) -> bool
friend

Compares an iterator against the end sentinel.

Provided in both argument orders (and as both == and !=) so the range-for idiom, while (it != result.end()) loops, and wrapper code all work regardless of which operand is written first. Iterators are intentionally never comparable to one another: a single-pass stream has one position, so iterator-to-iterator equality would be meaningless — the type only ever compares against end().

◆ operator== [2/2]

auto operator== ( end_sentinel end,
const iterator & it ) -> bool
friend

The documentation for this class was generated from the following file: