다음을 통해 공유


list::emplace_front

Adds an element constructed in place to the beginning of a list.

void emplace_front(
   Type&& _Val
); 

Parameters

Parameter

Description

_Val

The element added to the beginning of the list Class.

Remarks

If an exception is thrown, the list is left unaltered and the exception is rethrown.

Example

// list_emplace_front.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
#include <string>

int main( ) 
{
   using namespace std;
   list <string> c2;
   string str("a");

   c2.emplace_front( move( str ) );
   cout << "Moved first element: " << c2.front( ) << endl;
}
Moved first element: a

Requirements

Header: <list>

Namespace: std

See Also

Reference

list Class

Standard Template Library

Other Resources

list Class Members