Espaços nominais
Variantes
Acções

std::list::push_back

Da cppreference.com
< cpp‎ | container‎ | list

 
 
 
std::list
Funções de membro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::list
list::~list
list::operator=
list::assign
list::get_allocator
acesso. Elemento
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::front
list::back
Iteradores
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::begin
list::cbegin

(C++11)
list::end
list::cend

(C++11)
list::rbegin
list::crbegin

(C++11)
list::rend
list::crend

(C++11)
Capacidade
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::empty
list::size
list::max_size
Modificadores
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::clear
list::insert
list::emplace(C++11)
list::erase
list::push_front
list::emplace_front(C++11)
list::pop_front
list::push_back
list::emplace_back(C++11)
list::pop_back
list::resize
list::swap
Operações
Original:
Operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::merge
list::splice
list::remove
list::remove_if
list::reverse
list::unique
list::sort
 
void push_back( const T& value );
void push_back( T&& value );
(a partir do C++ 11)
Acrescenta o value elemento dado à extremidade do recipiente.
Original:
Appends the given element value to the end of the container.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

No iterators or references are invalidated.

Índice

[editar] Parâmetros

value -
o valor do elemento a ser anexado
Original:
the value of the element to append
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Requisitos

1)
value será CopyInsertable
Original:
value shall be CopyInsertable
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
value será MoveInsertable
Original:
value shall be MoveInsertable
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

(Nenhum)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Complexidade

Constante.
Original:
Constant.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exemplo

O código a seguir usa push_back para adicionar vários números inteiros para uma std::list<int>:
Original:
The following code uses push_back to add several integers to a std::list<int>:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <list>
#include <iostream>
 
int main()
{
    std::list<int> numbers;
 
    numbers.push_back(42);
    numbers.push_back(314159); 
 
    for (int i : numbers) { // c++11 range-based for loop
        std::cout << i << '\n';
    } 
 
    return 0;
}

Output:

42
314159

[editar] Veja também

constrói elementos no lugar, na extremidade
Original:
constructs elements in-place at the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro) [edit]
insere elementos no início
Original:
inserts elements to the beginning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro) [edit]
remove o último elemento
Original:
removes the last element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro) [edit]