Defined in header <cparse/Cursor.hh>
stream_type::char_type peek();
Returns the next character from the stream without consuming it. Neither the line nor the column counter is updated — peeks do not advance position.
Parameters
None.
Return value
The next character in the stream. No sentinel on end-of-input — a throw occurs instead.
Exceptions
- Throws
std::runtime_errorwith the message[Cursor::peek] invalid streamif the internal stream pointer is null. - Throws
std::ios_base::failureif the stream signalsfailbit,eofbitorbadbit, per the exception mask set by the constructors.
Notes
Use safePeek() inside condition expressions (while, if) so a peek at the end of input does not throw out of the condition.
See also
- Cursor::safePeek — non-throwing variant.
- Cursor::get — inspect and consume.

