다음을 통해 공유


list::end

주소 목록에 있는 마지막 요소 뒤에 위치 하는 반복기를 반환 합니다.

const_iterator end( ) const;
iterator end( );

반환 값

주소 목록에 있는 마지막 요소 뒤에 위치 하는 양방향 반복기입니다.목록 다음 비어 있으면 list::end == list::begin.

설명

최종 반복기를 목록의 끝에 도달 했는지 여부를 테스트 하는 데 사용 됩니다.

예제

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

요구 사항

헤더: <list>

네임 스페이스: std

참고 항목

참조

list Class

표준 템플릿 라이브러리