deque::end

返回解决成功最后一个元素所在的位置、向量、双端队列的迭代器。

const_iterator end( ) const;
iterator end( );

返回值

解决成功最后一个元素所在的位置、向量、双端队列的一个随机访问迭代器。如果、向量、双端队列为空,然后deque::end == deque::begin。

备注

结束 用于测试迭代器是否已到达其、向量、双端队列的末尾。

示例

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

deque::begin 和 deque::end

标准模板库