Compartilhar via


deque::end

Retorna um iterador que a fim de atender ao local que tem êxito o elemento o mais recente em um deque.

const_iterator end( ) const; 
iterator end( );

Valor de retorno

Um iterador de acesso aleatório que a fim de atender ao local que tem êxito o elemento o mais recente em um deque. Se o deque estiver vazia, em deque::begin == de deque::end.

Comentários

end é usado para testar se um iterador um chegou ao final do deque.

Exemplo

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

Requisitos

Cabeçalho: <deque>

Namespace: std

Consulte também

Referência

Classe deque

deque::begin e deque::end

Biblioteca de Modelos Padrão