list::emplace_back
Adds an element constructed in place to the beginning of a list.
void emplace_back(
Type&& _Val
);
Parameters
Parameter |
Description |
_Val |
The element added to the end of the list Class. |
Remarks
If an exception is thrown, the list is left unaltered and the exception is rethrown.
Example
// 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;
}
Moved first element: a
Requirements
Header: <list>
Namespace: std