nlohmann::basic_json::emplace

add an object to an object if key does not exist

Synopsis

Declared in <nlohmann/json.hpp>

template<class... Args>
std::pair<iterator, bool>
emplace(Args&&... args);

Return Value

pair of an iterator to the element that was inserted, or that already existed with the same key, and a bool denoting whether the insertion took place

Parameters

NameDescription
argsarguments forwarded to construct the new key-value pair in place