Aracılığıyla paylaş


list::end

İzleyen bir liste içindeki son öğenin konumuna gideren bir yineleyici döndürür.

const_iterator end( ) const;
iterator end( );

Dönüş Değeri

İzleyen bir liste içindeki son öğenin konumunu ele çift yönlü Yineleyici.Liste boşsa, list::end == list::begin.

Notlar

Son bir yineleyici, listenin sonuna ulaştı olup olmadığını sınamak için kullanılır.

Örnek

// list_end.cpp
// compile with: /EHsc
#include <list>
#include <iostream>

int main( ) 
{
   using namespace std;
   list <int> c1;
   list <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:
   // list <int>::const_iterator c1_Iter;
   // an error would have resulted when inserting the 400

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

Gereksinimler

Başlık: <list>

Namespace: std

Ayrıca bkz.

Başvuru

list Class

Standart Şablon Kütüphanesi