Defined in header <cparse/Parser.hh>
protected:
Cursor const& storeCursor();
Calls Cursor::store() on the active cursor and returns a const reference to it. Used internally by extractToken as the first step of its save-and-try-restore pattern.
Parameters
None.
Return value
A const reference to the active cursor after store() has been called on it. The reference is stable for the current parse but becomes invalid the moment a pushCursor swaps the active cursor.
Exceptions
May throw if Cursor::store() throws. The store() implementation is noexcept, so storeCursor() does not throw in practice.
Notes
storeCursor() returns a reference, not a snapshot. Restoring via restoreCursor() with this reference works because restoreCursor() also calls restore(), seeking the stream back to the position that was store()d.
For a truly independent snapshot that survives further cursor mutations, copy the cursor by value:
Cursor snapshot = getCursor(); // real copy
This uses Cursor::Cursor(Cursor const&) and shares the underlying stream but decouples the position record.
See also
- Parser::restoreCursor — the paired restore.
- Cursor::store — the underlying store.
- Parser::extractToken — the primary internal user.

