单个字符 (1) | template<class charT, class traits>basic_istream<charT,traits>& operator>> (basic_istream<charT,traits>& is, charT& c);template<class traits>basic_istream<char,traits>& operator>> (basic_istream<char,traits>& is, signed char& c);template<class traits>basic_istream<char,traits>& operator>> (basic_istream<char,traits>& is, unsigned char& c); |
---|---|
character sequence (2) | template<class charT, class traits>basic_istream<charT,traits>& operator>> (basic_istream<charT,traits>& is, charT* s);template<class traits>basic_istream<char,traits>& operator>> (basic_istream<char,traits>& is, signed char* s);template<class traits>basic_istream<char,traits>& operator>> (basic_istream<char,traits>& is, unsigned char* s); |
单个字符 (1) | template<class charT, class traits>basic_istream<charT,traits>& operator>> (basic_istream<charT,traits>& is, charT& c);template<class traits>basic_istream<char,traits>& operator>> (basic_istream<char,traits>& is, signed char& c);template<class traits>basic_istream<char,traits>& operator>> (basic_istream<char,traits>& is, unsigned char& c); |
---|---|
character sequence (2) | template<class charT, class traits>basic_istream<charT,traits>& operator>> (basic_istream<charT,traits>& is, charT* s);template<class traits>basic_istream<char,traits>& operator>> (basic_istream<char,traits>& is, signed char* s);template<class traits>basic_istream<char,traits>& operator>> (basic_istream<char,traits>& is, unsigned char* s); |
rvalue extraction (3) | template<class charT, class traits, class T>basic_istream<charT,traits>& operator>> (basic_istream<charT,traits>&& is, T& val); |
>>
)应用于输入流时,称为提取运算符,执行格式化输入(width()-1)
个字符(如果 width 不为零)就会停止。charT()
)会自动追加到写入的序列中。is>>val
。false
来构造一个 sentry 来访问 is 的输入序列:这可能会刷新其绑定的流和/或丢弃前导空白(请参阅 basic_istream::sentry)。然后(如果 good),它从 is 的关联流缓冲区对象中提取字符(如同调用其成员函数 sbumpc 或 sgetc),最后销毁 sentry 对象后返回。flag | error |
---|---|
eofbit | 该函数停止提取字符,因为由 is 控制的输入序列已无更多可用字符(已到达文件尾)。 |
failbit | 要么没有提取字符,要么无法将它们解释为相应类型的有效值。 |
badbit | 流错误(例如,当此函数捕获由内部操作抛出的异常时)。 当设置此标志时,流的完整性可能受到影响。 |
|
|