protected virtual member function
<streambuf> <iostream>

std::basic_streambuf::overflow

int_type overflow (int_type c = traits_type::eof());
Put character on overflow
Virtual function called by other member functions to put a character into the controlled output sequence without changing the current position.

It is called by public member functions such as sputc to write a character when there are no writing positions available at the put pointer (pptr).

Its default behavior in basic_streambuf is to always return traits_type::eof() (indicating failure), but derived classes can override this behavior to attempt to write the character directly and/or to alter pptr and other internal pointers so that more storage is provided, potentially writing unwritten characters to the controlled output sequence. Both basic_filebuf and basic_stringbuf override this virtual member function.

参数

c
Character to be put.
If this is the end-of-file value (traits_type::eof()), no character is put, but the other effects of calling this function are attempted.
成员类型int_type是能够表示任何字符值或特殊*文件结束*符的整型。

返回值

In case of success, the character put is returned, converted to a value of type int_type using member traits_type::to_int_type.
Otherwise, it returns the end-of-file value (traits_type::eof()) either if called with this value as argument c or to signal a failure (some implementations may throw an exception instead).
成员类型int_type是能够表示任何字符值或特殊*文件结束*符的整型。

数据竞争

修改*流缓冲区*对象。
同时访问同一*流缓冲区*对象可能会导致数据竞争。

异常安全

基本保证:如果抛出异常,*流缓冲区*处于有效状态。

另见