summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-14 02:49:30 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-14 02:49:30 +0100
commit11331e9639e51306eee5171381d6755921ca6c63 (patch)
tree9a58136e3aa2909c3490b0f0ed7c68b4f7ed4437
parent973ff14180d874e977bc6bc0743845d4f3919279 (diff)
downloadserenity-11331e9639e51306eee5171381d6755921ca6c63.zip
Add Vector::take_first().
-rw-r--r--AK/Vector.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/AK/Vector.h b/AK/Vector.h
index 984573ec7e..c406e9db7d 100644
--- a/AK/Vector.h
+++ b/AK/Vector.h
@@ -146,6 +146,14 @@ public:
return value;
}
+ T take_first()
+ {
+ ASSERT(!is_empty());
+ T value = move(first());
+ remove(0);
+ return value;
+ }
+
void remove(size_t index)
{
m_impl->remove(index);