다음을 통해 공유


list::pop_back

목록의 끝에 있는 요소를 삭제합니다.

void pop_back( );

설명

마지막 요소는 비어 있어야 합니다.pop_back예외를 throw 하지 않습니다.

예제

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

int main( ) 
{
   using namespace std;
   list <int> c1;
   
   c1.push_back( 1 );
   c1.push_back( 2 );
   cout << "The first element is: " << c1.front( ) << endl;
   cout << "The last element is: " << c1.back( ) << endl;

   c1.pop_back( );
   cout << "After deleting the element at the end of the list, "
           "the last element is: " << c1.back( ) << endl;
}
  

요구 사항

헤더: <list>

네임 스페이스: std

참고 항목

참조

list Class

표준 템플릿 라이브러리