envzn
0.8 · beta · not released

Library / Core interfaces / Collections and iteration / ReferenceIterator

INTERFACEEXTENDS Iterator<T>

ReferenceIterator

ReferenceIterator OF T — extends Iterator with by-reference navigation. Implemented by the collection iterators, whose backing storage is referenceable: next() / peek() / skip() hand back a non-owning reference into the source rather than a copy. Buffer iterators (over by-value _cxx* storage) implement only the value-form Iterator. next/peek/skip hand back a REFERENCE and never clone, so Cloneable was never used; Shareable joins it so the OwnedList family qualifies.

Methods 3

MODIFY METHOD next() RETURNS | REFERENCE T
modifies

2.0 pipe-XOR shape: a successful navigation populates value with a non-owning reference into the source; end-of-iteration or invariant violation populates s with FAILURE. The caller's IF iter->next() THEN { binding REFERENCE T v =@ $RETURNED } ELSE { ... } binds the populated slot.

METHOD peek() RETURNS | REFERENCE T
reads

peek is non-PANICing and non-consuming: returns the reference at the current cursor without advancing. Same pipe-XOR shape as next().

MODIFY METHOD skip(uint64 n) RETURNS | REFERENCE T
modifies