From 870be9d71ecf9e552ac7cb673b482b22666edcdf Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 7 Nov 2019 20:38:24 +0100 Subject: [PATCH] AK: Add Vector::take(index) This removes an item from the vector and returns it. --- AK/Vector.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/AK/Vector.h b/AK/Vector.h index 76c96d05b8..012b23ae27 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -263,6 +263,13 @@ public: return value; } + T take(int index) + { + T value = move(at(index)); + remove(index); + return value; + } + void remove(int index) { ASSERT(index < m_size);