From c66f645c92f09fbc1b5afa4287c70f33722b60e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=95=EC=A4=80?= Date: Fri, 5 Aug 2022 16:21:15 +0900 Subject: [PATCH] added check obj lhs & rhs // use update func --- include/nlohmann/json.hpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 1a194e8b7..957caedd1 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -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; }