protected virtual member function
<streambuf> <iostream>


int_type underflow();
Get character on underflow
Virtual function called by other member functions to get the current character in the controlled input sequence without changing the current position.

It is called by public member functions such as sgetc to request a new character when there are no read positions available at the get pointer (gptr).

Its default behavior in basic_streambuf is to always return traits_type::eof() (indicating failure), but derived classes can override this behavior to modify the gptr and egptr internal pointers in such a way that more characters from the input sequence may be made accessible through the buffer (if these are available). Both basic_filebuf and basic_stringbuf override this virtual member function.



Return Value

On success, the value of the character put back, converted to a value of type int_type using member traits_type::to_int_type.
The function returns the end-of-file value (traits_type::eof()) on failure.

Data races

Modifies the stream buffer object.
Concurrent access to the same stream buffer object may introduce data races.

Exception safety

Basic guarantee: if an exception is thrown, the stream buffer is in a valid state.

See also