次の方法で共有


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

標準テンプレート ライブラリ