From 500dc83f32e59feb5416301a5caa11e15f87fe0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Mon, 27 Jun 2022 23:30:44 +0200 Subject: [PATCH] AK: Add FixedArray::fill_with This is a memset-like utility method. --- AK/FixedArray.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AK/FixedArray.h b/AK/FixedArray.h index 4fed8a86c90..90cc2d6bb80 100644 --- a/AK/FixedArray.h +++ b/AK/FixedArray.h @@ -160,6 +160,12 @@ public: ::swap(m_elements, other.m_elements); } + void fill_with(T const& value) + { + for (size_t i = 0; i < m_size; ++i) + m_elements[i] = value; + } + using Iterator = SimpleIterator; using ConstIterator = SimpleIterator;