std::unordered_multimap<Key,T,Hash,KeyEqual,Allocator>::emplace
Min standard notice:
Inserts a new element into the container constructed in-place with the given args.
# Declarations
template< class... Args >
iterator emplace( Args&&... args );
(since C++11)
# Parameters
args: arguments to forward to the constructor of the element
# Return value
An iterator to the inserted element.
# Example
#include <iostream>
#include <string>
#include <utility>
#include <unordered_map>
int main()
{
std::unordered_multimap<std::string, std::string> m;
// uses pair's move constructor
m.emplace(std::make_pair(std::string("a"), std::string("a")));
// uses pair's converting move constructor
m.emplace(std::make_pair("b", "abcd"));
// uses pair's template constructor
m.emplace("d", "ddd");
// emplace with duplicate key
m.emplace("d", "DDD");
// uses pair's piecewise constructor
m.emplace(std::piecewise_construct,
std::forward_as_tuple("c"),
std::forward_as_tuple(10, 'c'));
for (const auto& p : m)
std::cout << p.first << " => " << p.second << '\n';
}