diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-08 13:08:21 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-08 13:08:21 +0200 |
commit | a8aadf73e98a6aca7a610744e4d9971739338d84 (patch) | |
tree | bc72918fa305a939d5a118c0ee7eb405882ea58a /AK/JsonObject.h | |
parent | 7bb1e465c627cdf4305e306d6c261f8b39c4a7f8 (diff) | |
download | serenity-a8aadf73e98a6aca7a610744e4d9971739338d84.zip |
AK: Add JsonObject::set(key, &&value) overload.
This dodges a whole bunch of value copying in JsonParser.
Diffstat (limited to 'AK/JsonObject.h')
-rw-r--r-- | AK/JsonObject.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/AK/JsonObject.h b/AK/JsonObject.h index cb8a71a40f..2796db1c53 100644 --- a/AK/JsonObject.h +++ b/AK/JsonObject.h @@ -22,9 +22,14 @@ public: return (*it).value; } + void set(const String& key, JsonValue&& value) + { + m_members.set(key, move(value)); + } + void set(const String& key, const JsonValue& value) { - m_members.set(key, value); + m_members.set(key, JsonValue(value)); } template<typename Callback> |