Share via


list::emplace_back

イン プレースで構築された要素をリストの先頭に追加します。

void emplace_back(    Type&& _Val );

パラメーター

パラメーター

説明

_Val

list クラス の末尾に追加する要素。

解説

例外がスローされた場合、list は変更されず、例外が再度スローされます。

使用例

// 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

参照

関連項目

list クラス

標準テンプレート ライブラリ