Skip to content

Truly independent web browser

LibGC: Allow constructing a RootVector from an initializer list

Shannon Booth73ea927e413e
diff --git a/Libraries/LibGC/RootVector.h b/Libraries/LibGC/RootVector.h
index f00a8afabf5..6bf53bc72e1 100644
--- a/Libraries/LibGC/RootVector.h
+++ b/Libraries/LibGC/RootVector.h
@@ -64,6 +64,14 @@ public:
{
}
+ // The element type is named through VectorBase so that class template argument deduction never picks this
+ // constructor, which would deduce a RootVector of Vectors from GC::RootVector { move(vector) }.
+ RootVector(std::initializer_list<typename VectorBase::ValueType> list)
+ : RootVectorBase()
+ , VectorBase(list)
+ {
+ }
+
RootVector(RootVector const& other)
: RootVectorBase(*other.m_heap)
, Vector<T, inline_capacity>(other)