The difference of uflow and underflow functions ?

G

Guest

Sory about stupid question.

What are differences between uflow and underflow functions ?
Pls explains.
Tks
 
P

Peter van Merkerk

Sory about stupid question.

It would have been a good question if you told us the class of these
(member) functions. I assume you are talking about the members of
std::basic_streambuf and derived classes.
What are differences between uflow and underflow functions ?
Pls explains.

This is what the standard has to say about it:

int_type uflow();

Requires: The constraints are the same as for underflow(), except that
the result character is trans-ferred
from the pending sequence to the backup sequence, and the pending
sequence may not be empty
before the transfer.

Default behavior: Calls underflow(). If underflow() returns
traits::eof(), returns
traits::eof(). Otherwise, returns the value of
traits::to_int_type(*gptr()) and
increment the value of the next pointer for the input sequence.

Returns: traits::eof() to indicate failure.
 
C

Chris Taylor

Hi,

underflow attempts to return the current element from the input stream, but
does not advance the the input stream position. While uflow attempts to
return the current element and advances the stream position if successfull.
uflow is typically implemented by calling underflow and if underflow does
not return traits_type::eof it adjusts the stream position.

Hope this helps

Chris Taylor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top