nlohmann::ordered_map::emplace

inserts a new element constructed from key and t if the key does not already exist

Synopses

Declared in <nlohmann/ordered_map.hpp>

inserts a new element constructed from key and t if the key does not already exist

std::pair<iterator, bool>
emplace(
    key_type const& key,
    T&& t);
» more...

inserts a new element constructed from key and t if the key does not already exist

template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
std::pair<iterator, bool>
emplace(
    KeyType&& key,
    T&& t);
» more...

Return Value

pair of an iterator to the (possibly pre-existing) element and a bool that is true if the insertion took place

Parameters

NameDescription
key [in]key of the element to insert
t [in]value of the element to insert