다음을 통해 공유


deque::end

Returns an iterator that addresses the location succeeding the last element in a deque.

const_iterator end( ) const; 
iterator end( );

반환 값

A random-access iterator that addresses the location succeeding the last element in a deque. If the deque is empty, then deque::end == deque::begin.

설명

end is used to test whether an iterator has reached the end of its 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

표준 템플릿 라이브러리