Compartilhar via


hash_multiset::emplace_hint

Note

This API is obsolete. The alternative is unordered_multiset Class.

Inserts an element constructed in place into a hash_multiset, with a placement hint.

template<class ValTy>
    iterator insert(
        const_iterator _Where,
        ValTy&& _Val
);

Parameters

Parameter

Description

_Val

The value of an element to be inserted into the hash_multiset Class unless the hash_multiset already contains that element or, more generally, an element whose key is equivalently ordered.

_Where

The place to start searching for the correct point of insertion. (Insertion can occur in amortized constant time, instead of logarithmic time, if the insertion point immediately follows _Where.)

Return Value

The hash_multiset::emplace member function returns an iterator that points to the position where the new element was inserted into the hash_multiset.

Remarks

Insertion can occur in amortized constant time, instead of logarithmic time, if the insertion point immediately follows _Where.

In Visual C++ .NET 2003, members of the <hash_map> and <hash_set> header files are no longer in the std namespace, but rather have been moved into the stdext namespace. See The stdext Namespace for more information.

Example

// hash_multiset_emplace_hint.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
#include <string>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_multiset<string> hms1;
   string str1("a");

   hms1.insert(hms1.begin(), move(str1));
   cout << "After the emplace insertion, hms1 contains "
      << *hms1.begin() << "." << endl;
}
After the emplace insertion, hms1 contains a.

Requirements

Header: <hash_set>

Namespace: stdext

See Also

Reference

hash_multiset Class

Standard Template Library