共用方式為


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;
   }
}
  您會返回。

FakePre-c836755159574c35b618509d1c8200cd-22c4962320f745c6b55e16c6d19d12ca

需求

標題: <iterator>

命名空間: std

請參閱

參考

istreambuf_iterator Class

標準樣板程式庫