共用方式為


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

標準樣板程式庫