English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
STL Set (Conjunto) ++ A função push_front() da lista adiciona um novo elemento no início. Portanto, o tamanho da lista aumenta em um.
A função push_front(0) adiciona o elemento 0 no início.
Suponha que um elemento seja "x":
void push_front(const value_type& x);
x: Este é o valor a ser inserido no início da lista.
Ele não retorna nenhum valor.
Vamos ver um exemplo simples
#include <iostream> #include#include<list> using namespace std; int main() {2,3,4,5list li={ 0});10li.push_front( ); list::iterator itr;++for(itr=li.begin();itr!=li.end(); itr){*cout<< return 0; itr<<","; return 0;
}
10Saída:2,3,4,5Copyright ©
0, 10Neste exemplo, a função push_front() inserirá o elemento “