front_insert_iterator::reference

提供对元素的引用。顺序控制由容器关联的类型。

typedef typename Container::reference reference;

示例

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

int main( )
{
   using namespace std;

   list<int> L;
   front_insert_iterator<list<int> > fiivIter( L );
   *fiivIter = 10;
   *fiivIter = 20;
   *fiivIter = 30;
   
   list<int>::iterator LIter;
   cout << "The list L is: ( ";
   for ( LIter = L.begin ( ) ; LIter != L.end ( ); LIter++)
      cout << *LIter << " ";
   cout << ")." << endl;

   front_insert_iterator<list<int> >::reference 
        RefFirst = *(L.begin ( ));
   cout << "The first element in the list L is: " 
        << RefFirst << "." << endl;
}
  

要求

头文件: <iterator>

命名空间: std

请参见

参考

front_insert_iterator 类

标准模板库