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

std::strstreambuf::pbackfail

std::strStreambuf::pback Failure

protected: virtual int_type pbackfail( int_type c = EOF

此受保护的虚拟函数由公共函数调用。basic_streambuf::sungetcbasic_streambuf::sputbackc%28,依次被basic_istream::ungetbasic_istream::putback29%。

1%29调用方请求GET区域由一个字符%28备份pbackfail()调用时,不带任何参数,也不带EOF作为论点%29

首先,检查是否有一个备用位置,如果真的有%27T,则失败。%28 strStrebuf没有外部字符源来重新读取%29

B%29如果呼叫方出错,并且实际上可以使用回发位置,则只需减少basic_streambuf::gptr(),例如通过打电话gbump(-1)...

2%29调用者尝试将一个与先前检索的字符不同的字符pbackfail()使用需要返回%29的字符调用,在这种情况下

首先检查是否有一个回放位置,如果有%27T,则检查失败。

B%29然后检查哪个字符处于回推位置。如果那里的字符已经等于(char)c,然后简单地减少basic_streambuf::gptr()...

否则,如果缓冲区为不可修改的%28,则此strStrebuf是用字符串文本或其他字符串构造的。const数组%29,失败。

d%29否则,减少basic_streambuf::gptr()c调整后指向gptr%28%29的位置。

参数

c-the character to put back, or Traits::eof() to indicate that backing up of the get area is requested

返回值

c关于成功,除非cEOF,在这种情况下,除EOF会被归还。

EOF在失败的时候。

另见

pbackfail virtualputs a character back into the input sequence, possibly modifying the input sequence (virtual protected member function of std::basic_streambuf)
sungetcmoves the next pointer in the input sequence back by one (public member function of std::basic_streambuf)
sputbackcputs one character back in the input sequence (public member function of std::basic_streambuf)
ungetunextracts a character (public member function of std::basic_istream)
putbackputs character into input stream (public member function of std::basic_istream)

© cppreference.com

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

http://en.cppreference.com/w/cpp/io/strStrebuf/pback