diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-14 02:49:30 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-14 02:49:30 +0100 |
commit | 11331e9639e51306eee5171381d6755921ca6c63 (patch) | |
tree | 9a58136e3aa2909c3490b0f0ed7c68b4f7ed4437 | |
parent | 973ff14180d874e977bc6bc0743845d4f3919279 (diff) | |
download | serenity-11331e9639e51306eee5171381d6755921ca6c63.zip |
Add Vector::take_first().
-rw-r--r-- | AK/Vector.h | 8 |
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); |