Share via


list::emplace

指定した位置において、構築された要素をリスト内の適切な場所に挿入します。

void emplace_back(    iterator _Where,    Type&& _Val );

パラメーター

パラメーター

説明

_Where

最初の要素が挿入される、対象の list クラス 内の位置。

_Val

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

解説

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

使用例

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

参照

関連項目

list クラス

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