AK: Allow constructing a JsonArray from any array-like type

This commit is contained in:
kleines Filmröllchen 2022-01-27 13:03:20 +01:00 committed by Andreas Kling
parent 2f631f7dc0
commit cfb8eeebe8
Notes: sideshowbarker 2024-07-17 20:04:32 +09:00

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/Concepts.h>
#include <AK/JsonArraySerializer.h>
#include <AK/JsonValue.h>
#include <AK/Vector.h>
@ -27,10 +28,10 @@ public:
{
}
template<typename T>
JsonArray(Vector<T> const& vector)
template<IterableContainer ContainerT>
JsonArray(ContainerT const& source)
{
for (auto& value : vector)
for (auto& value : source)
m_values.append(move(value));
}