diff options
author | Linus Groh <mail@linusgroh.de> | 2021-01-15 20:12:02 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-15 23:26:47 +0100 |
commit | e83799dc02dfd092cf8970e7df587cd24eadc25c (patch) | |
tree | 6f0fb834c394cfca86a177b49d4e8491095ca822 | |
parent | 4839f36f5ed688cb56171a50e11845f7a44cf0c4 (diff) | |
download | serenity-e83799dc02dfd092cf8970e7df587cd24eadc25c.zip |
AK: Add JsonArray(const Vector<T>) constructor
This simplifies creating a JsonArray from a Vector<T> (when there's a
JsonValue(T) constructor overload for T, that is).
-rw-r--r-- | AK/JsonArray.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/AK/JsonArray.h b/AK/JsonArray.h index 5d9fe62abb..aea8601f34 100644 --- a/AK/JsonArray.h +++ b/AK/JsonArray.h @@ -47,6 +47,13 @@ public: { } + template<typename T> + JsonArray(const Vector<T>& vector) + { + for (auto& value : vector) + m_values.append(move(value)); + } + JsonArray& operator=(const JsonArray& other) { if (this != &other) |