次の方法で共有


deque::end

deque 内の最後の要素の次の場所を指定する反復子を返します。

const_iterator end( ) const; 
iterator end( );

戻り値

deque 内の最後の要素の次の場所を示すランダム アクセス反復子。 deque が空の場合、deque::end == の deque::begin。

解説

反復子が deque の末尾に到達したかどうかをテストするために終了 が 使用されます。

使用例

// deque_end.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>

int main( ) 
{
   using namespace std;
   deque <int> c1;
   deque <int>::iterator c1_Iter;
   
   c1.push_back( 10 );
   c1.push_back( 20 );
   c1.push_back( 30 );

   c1_Iter = c1.end( );
   c1_Iter--;
   cout << "The last integer of c1 is " << *c1_Iter << endl;

   c1_Iter--;
   *c1_Iter = 400;
   cout << "The new next-to-last integer of c1 is " << *c1_Iter << endl;

   // If a const iterator had been declared instead with the line:
   // deque <int>::const_iterator c1_Iter;
   // an error would have resulted when inserting the 400

   cout << "The deque is now:";
   for ( c1_Iter = c1.begin( ); c1_Iter != c1.end( ); c1_Iter++ )
      cout << " " << *c1_Iter;
}
  

必要条件

ヘッダー: <deque>

名前空間: std

参照

関連項目

deque クラス

deque::begin と deque::end

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