istreambuf_iterator::operator*

的取消引用运算符返回在流中的下一个字符。

CharType operator*( ) const;

返回值

在流中的下一个字符。

示例

// istreambuf_iterator_operator_deref.cpp
// compile with: /EHsc
#include <iterator>
#include <iostream>

int main( )
{
   using namespace std;

   cout << "Type string of characters & enter to output it,\n"
      << " with stream buffer iterators,(try: 'I'll be back.')\n"
      << " repeat as many times as desired,\n" 
      << " then keystroke ctrl-Z Enter to exit program: ";
   istreambuf_iterator<char> inpos ( cin );
   istreambuf_iterator<char> endpos;
   ostreambuf_iterator<char> outpos ( cout );
   while ( inpos != endpos )
   {
      *outpos = *inpos;   //Put value of outpos equal to inpos
      ++inpos;
      ++outpos;
   }
}
  我将返回。
  我将返回。
键入字符串并输出,它与流缓冲区迭代器,(尝试:“我将返回。”)重复多次按照需要,击键CTRL Z然后enter退出程序:我将返回。我将返回。^Z

要求

标头: <iterator>

命名空间: std

请参见

参考

istreambuf_iterator Class

标准模板库