Aracılığıyla paylaş


list::push_back

Bir listenin sonuna bir öğe ekler.

void push_back(

void push_back(
   Type&& _Val
);

Parametreler

Parametre

Description

_Val

Öğe listesinin sonuna eklenir.

Notlar

Bir özel durum oluşursa, listenin sol değiştirmeden ve özel durum rethrown.

Örnek

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

int main( ) 
{
   using namespace std;
   list <int> c1;
   
   c1.push_back( 1 );
   if ( c1.size( ) != 0 )
      cout << "Last element: " << c1.back( ) << endl;

   c1.push_back( 2 );
   if ( c1.size( ) != 0 )
      cout << "New last element: " << c1.back( ) << endl;

// move initialize a list of strings
   list <string> c2;
   string str("a");

   c2.push_back( move( str ) );
   cout << "Moved first element: " << c2.back( ) << endl;
}
  

Gereksinimler

Başlık: <list>

Namespace: std

Ayrıca bkz.

Başvuru

list Class

Standart Şablon Kütüphanesi