\brief Return the next element of the sequence, IterationTraits ::End() when the iteration is completed.
| 113 | /// \brief Return the next element of the sequence, IterationTraits<T>::End() when the |
| 114 | /// iteration is completed. |
| 115 | Result<T> Next() { |
| 116 | if (ptr_) { |
| 117 | auto next_result = next_(ptr_.get()); |
| 118 | if (next_result.ok() && IsIterationEnd(next_result.ValueUnsafe())) { |
| 119 | ptr_.reset(NULLPTR); |
| 120 | } |
| 121 | return next_result; |
| 122 | } else { |
| 123 | return IterationTraits<T>::End(); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | /// Pass each element of the sequence to a visitor. Will return any error status |
| 128 | /// returned by the visitor, terminating iteration. |