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

std::basic_stringbuf::pbackfail

性病:基本[医]Strucbuf::pbackFailure

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

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

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

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

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

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

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

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

否则,如果缓冲区仅供读取,则失败。

如果缓冲区为写入%28打开,则为D%29。mode &&std::ios_base::out为非零%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关于成功,除非cTraits::eof(),在这种情况下Traits::not_eof(c)会被归还。

Traits::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/basic[医]Strbuf/pback失败