insert_iterator::reference

提供对中的某个元素序列控件由关联的容器的类型。

typedef typename Container::reference reference;

备注

类型描述对元素的序列控件由关联的容器。

示例

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

int main( )
{
   using namespace std;

   list<int> L;
   insert_iterator<list<int> > iivIter( L , L.begin ( ) );
   *iivIter = 10;
   *iivIter = 20;
   *iivIter = 30;

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

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

要求

标头: <iterator>

命名空间: std

请参见

参考

insert_iterator Class

标准模板库