Defined in header <cparse/Cursor.hh>
void safeRestore() noexcept;
Same as restore() but wrapped in an exception-mask dance that lets it be called from a path where the stream is in eof or fail state:
- Save the current exception mask.
- Set the mask to
std::ios_base::goodbit(no exceptions). clear()the stream state.- Call
restore(). - Reinstate the saved exception mask.
Catches every exception. If the stream cannot be recovered, the function returns silently; subsequent reads will observe that isValid() returns false.
Parameters
None.
Return value
(none)
Exceptions
noexcept. Any exception from any step is caught.
Notes
Not currently called by Parser itself, but is the correct method to call from a grammar helper that has just unwound out of an ios_base::failure and wants to resume parsing from an earlier saved point. Reserved for grammars that implement recovery beyond what the default driver provides.
See also
- Cursor::restore — the throwing variant.
- Cursor::isValid — check whether the stream survived.

