list::emplace
Wstawia element skonstruowane w miejscu na listę na określonej pozycji.
void emplace_back( iterator _Where, Type&& _Val );
Parametry
Parametr |
Opis |
_Where |
Pozycja w celu list — Klasa gdzie zostanie wstawiona pierwszym elementem. |
_Val |
Element dodany do końca list. |
Uwagi
Jeśli wyjątek list jest niezmieniony w lewo i jest rethrown wyjątek.
Przykład
// list_emplace.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
#include <string>
int main( )
{
using namespace std;
list <string> c2;
string str("a");
c2.emplace(c2.begin(), move( str ) );
cout << "Moved first element: " << c2.back( ) << endl;
}
Wymagania
Nagłówek: < listy >
Przestrzeń nazw: std