From dc039fdc7ef2ec23cfde4a91eb81d07579c230c9 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 6 Mar 2020 08:49:48 +0100 Subject: [PATCH] AK: Simplify JsonObject and JsonArray API a little bit Instead of set(const JsonValue&) and set(JsonValue&&), just do set(JsonValue) and let callers move() if they want. This removes some ambiguity and the compiler is smart enough to optimize it anyway. --- AK/JsonArray.h | 3 +-- AK/JsonObject.h | 7 +------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/AK/JsonArray.h b/AK/JsonArray.h index 25b05fae3bc..af8654f6311 100644 --- a/AK/JsonArray.h +++ b/AK/JsonArray.h @@ -68,8 +68,7 @@ public: const JsonValue& operator[](int index) const { return at(index); } void clear() { m_values.clear(); } - void append(const JsonValue& value) { m_values.append(value); } - void append(JsonValue&& value) { m_values.append(move(value)); } + void append(JsonValue value) { m_values.append(move(value)); } template typename Builder::OutputType serialized() const; diff --git a/AK/JsonObject.h b/AK/JsonObject.h index da7a5d8f46f..f6d17a4d226 100644 --- a/AK/JsonObject.h +++ b/AK/JsonObject.h @@ -85,16 +85,11 @@ public: return m_members.contains(key); } - void set(const String& key, JsonValue&& 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, JsonValue(value)); - } - template void for_each_member(Callback callback) const {