在线文档教程
C++
输入/输出 | Input/output

std::basic_streambuf::pbackfail

性病:基本[医]Streambuf::pback Failure

protected: virtual int_type pbackfail( int_type c = Traits::eof()

此受保护的虚拟函数由公共函数调用。sungetc()sputbackc()%28,依次被basic_istream::ungetbasic_istream::putback%29,如果其中之一是:

1%29在GET区域%28没有回放位置pbackfail()调用时不带参数%29。在这种情况下,pbackfail()如果关联的字符序列允许此%28e.g,则按一个字符备份GET区域。文件支持的Streambuf可以从文件中重新加载缓冲区,在%29之前启动一个字符.

2%29调用者尝试将一个与先前检索的字符不同的字符pbackfail()使用需要返回%29的字符调用。在这种情况下,pbackfail()就是把角色c进入前面位置的GET区域basic_streambuf::gptr(),如果可能的话,修改相关的字符序列以反映此更改。这可能涉及备份GET区域,就像第一个变体中的那样。

此函数的默认基类版本不执行任何操作并返回Traits::eof()在任何情况下。派生类重写此函数:basic_stringbuf::pbackfail,,,basic_filebuf::pbackfail,,,strstreambuf::pbackfail,并且预期将被用户定义的和第三方库流类覆盖。

参数

ch-character to put back or Traits::eof() if only back out is requested

返回值

Traits::eof()在失败的情况下,一些其他的价值来表示成功。基类版本总是失败。

另见

pbackfail virtualbacks out the input sequence to unget a character, not affecting the associated file (virtual protected member function of std::basic_filebuf)
pbackfail virtualputs a character back into the input sequence (virtual protected member function of std::basic_stringbuf)
pbackfail virtualbacks out the input sequence to unget a character (virtual protected member function of std::strstreambuf)
sungetcmoves the next pointer in the input sequence back by one (public member function)
sputbackcputs one character back in the input sequence (public member function)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/io/basic[医]Streambuf/pback失败