list::emplace_back
생성된 요소를 목록 시작 부분에 추가합니다.
void emplace_back( Type&& _Val );
매개 변수
매개 변수 |
설명 |
_Val |
list 클래스 끝에 추가되는 요소입니다. |
설명
예외가 throw되면 list는 변경되지 않은 상태로 유지되며 예외가 다시 throw됩니다.
예제
// list_emplace_back.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
#include <string>
int main( )
{
using namespace std;
list <string> c2;
string str("a");
c2.emplace_back( move( str ) );
cout << "Moved first element: " << c2.back( ) << endl;
}
요구 사항
헤더: <list>
네임스페이스: std