diff --git a/AK/FixedArray.h b/AK/FixedArray.h index 7803d05028e..38725cd68dc 100644 --- a/AK/FixedArray.h +++ b/AK/FixedArray.h @@ -11,6 +11,7 @@ #include #include #include +#include namespace AK { @@ -21,6 +22,17 @@ class FixedArray { public: FixedArray() = default; + static ErrorOr> try_create(std::initializer_list initializer) + { + auto array = TRY(try_create(initializer.size())); + auto it = initializer.begin(); + for (size_t i = 0; i < array.size(); ++i) { + array[i] = move(*it); + ++it; + } + return array; + } + static ErrorOr> try_create(size_t size) { if (size == 0)