list::emplace
생성된 요소를 목록의 지정된 위치에 삽입합니다.
void emplace_back( iterator _Where, Type&& _Val );
매개 변수
매개 변수 |
설명 |
_Where |
대상 list 클래스에서 첫 번째 요소를 삽입하는 위치입니다. |
_Val |
list 끝에 추가되는 요소입니다. |
설명
예외가 throw되면 list는 변경되지 않은 상태로 유지되며 예외가 다시 throw됩니다.
예제
// 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;
}
요구 사항
헤더: <list>
네임스페이스: std