浏览代码

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).
Linus Groh 4 年之前
父节点
当前提交
e83799dc02
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      AK/JsonArray.h

+ 7 - 0
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)
     JsonArray& operator=(const JsonArray& other)
     {
     {
         if (this != &other)
         if (this != &other)