From fa8cf85c3c6b2641dce693c649868264f48d36a0 Mon Sep 17 00:00:00 2001 From: ChUrl Date: Sat, 16 Jul 2022 16:39:18 +0200 Subject: [PATCH] return removal status in arraylist --- c_os/user/lib/ArrayList.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/c_os/user/lib/ArrayList.h b/c_os/user/lib/ArrayList.h index 05b53e8..cbe2070 100644 --- a/c_os/user/lib/ArrayList.h +++ b/c_os/user/lib/ArrayList.h @@ -155,13 +155,15 @@ public: return this->remove_at(this->buffer_pos - 1); } - void remove(T e) { + int remove(T e) { for (unsigned int i = 0; i < this->buffer_pos; ++i) { if (this->buffer[i] == e) { this->copy_left(i); - return; + return 0; } } + + return -1; } T get(unsigned int i) const {