共用方式為


map::emplace_hint

插入項目建構適當的對應,以放置提示。

template<class ValTy>
   pair<iterator, bool> emplace_hint(
      const_iterator _Where,
      ValTy&& _Val
);

參數

參數

描述

_Val

要插入之項目的值。 map Class ,除非 map ,一般而言,已包含該項目或索引鍵相當於已排序的項目。

_Where

如需這個位置開始的提示下搜尋修正問題的外掛程式。

傳回值

map::emplace 成員函式來傳回bool元件傳回true的配對,如果插入點會進行錯誤的,如果 map 已經包含索引鍵具有等值的順序,,和Iterator元件傳回電子郵件地址的插入新項目或的項目已經在位置項目。

若要存取一組 pr 的 Iterator 元件 (此成員函式,請使用 pr.first和傳回它解除參考,請使用 *(pr.first)。 若要存取一組 pr 的 bool 元件 (此成員函式所傳回的,請使用 pr.second。

備註

項目的 value_type 為,因此,項目的值將會與第一個元件相等於這個機碼值和秒數的排序配對等於項目之資料值。

範例

// map_emplace_hint.cpp
// compile with: /EHsc
#include <map>
#include <iostream>
#include <string>

int main( ) {
    using namespace std;
    map<int, string> m1;
    pair<int, string> is1(1, "a");

    m1.emplace(m1.begin(), move(is1));
    cout << "After the emplace insertion, m1 contains:" << endl
      << " " << m1.begin()->first
      << " => " << m1.begin()->second
      << endl;
}

Output

After the emplace insertion, m1 contains:
 1 => a

需求

標題: <map>

命名空間: std

請參閱

參考

map Class

標準樣板程式庫