istream_iterator::operator*

取消引用运算符的返回 istream_iterator所涉及的类型存储的 类型 对象。

const Type& operator*( ) const;

返回值

类型存储类型的对象。

示例

// istream_iterator_operator.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <algorithm>
#include <iostream>

int main( )
{
   using namespace std;

   cout << "Enter integers separated by spaces & then\n"
        << " a character ( try example: '2 4 6 8 a' ): ";

   // istream_iterator from stream cin
   istream_iterator<int> intRead ( cin );

   // End-of-stream iterator
   istream_iterator<int> EOFintRead;

   while ( intRead != EOFintRead )
   {
      cout << "Reading:  " << *intRead << endl;
      ++intRead;
   }
   cout << endl;
}
   个 a2

FakePre-d386ed285cda47028082aa1093f40f7c-a10d1da4e27e47f19933ce52bd4f5d09

要求

头文件: <iterator>

命名空间: std

请参见

参考

istream_iterator 类

标准模板库