Partilhar via


basic_streambuf::pbackfail

A protected virtual member function that tries to put back an element into the input stream, then make it the current element (pointed to by the next pointer).

virtual int_type pbackfail(
   int_type _Meta = traits_type::eof( )
);

Parameters

  • _Meta
    The character to insert into the buffer, or traits_type::eof.

Return Value

If the function cannot succeed, it returns traits_type::eof or throws an exception. Otherwise, it returns some other value. The default behavior is to return traits_type::eof.

Remarks

If _Meta compares equal to traits_type::eof, the element to push back is effectively the one already in the stream before the current element. Otherwise, that element is replaced by traits_type::to_char_type(_Meta). The function can put back an element in various ways:

  • If a putback position is available, it can store the element into the putback position and decrement the next pointer for the input buffer.

  • It can make a putback position available by allocating new or additional storage for the input buffer.

  • For a stream buffer with common input and output streams, it can make a putback position available by writing out, to some external destination, some or all of the elements between the beginning and next pointers for the output buffer.

Requirements

Header: <streambuf>

Namespace: std

See Also

Reference

basic_streambuf Class

iostream Programming

iostreams Conventions

Other Resources

basic_streambuf Members