added check obj lhs & rhs // use update func

This commit is contained in:
김형준 2022-08-05 16:21:15 +09:00
parent efc1b9df62
commit c66f645c92

View File

@ -5074,19 +5074,12 @@ std::string to_string(const NLOHMANN_BASIC_JSON_TPL& j)
return j.dump();
}
inline nlohmann::json operator+(const nlohmann::json& lhs, const nlohmann::json& rhs)
NLOHMANN_BASIC_JSON_TPL_DECLARATION
inline NLOHMANN_BASIC_JSON_TPL operator+(const NLOHMANN_BASIC_JSON_TPL& lhs, const NLOHMANN_BASIC_JSON_TPL& rhs)
{
nlohmann::json ret;
for (const auto& el : lhs.items())
{
ret[el.key()] = el.value();
}
for (const auto& el : rhs.items())
{
ret[el.key()] = el.value();
}
NLOHMANN_BASIC_JSON_TPL ret;
ret.update(lhs, true);
ret.update(rhs, true);
return ret;
}