共用方式為


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;
   }
}
  您會返回。
  您會返回。
型別字串 _&;RYAN I/O,它具有資料流緩衝區 Iterator, (try:「I'll 傳回。」) 重複次數視需要,按鍵 CTRL Z 然後 ENTER 鍵即可結束程式:您會返回。您會返回。^Z

需求

標題: <iterator>

命名空間: std

請參閱

參考

istreambuf_iterator Class

標準樣板程式庫