共用方式為


deque::end

傳回處理成功最後一個項目的位置在雙向佇列的 Iterator。

const_iterator end( ) const; 
iterator end( );

傳回值

處理成功最後一個項目的位置在雙向佇列的隨機存取 Iterator。 如果兩個佇列是空的,則 deque::end == deque::begin。

備註

end 用來測試 Iterator 是否已到達的雙向佇列的結尾。

範例

// 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

標準樣板程式庫