1

return removal status in arraylist

This commit is contained in:
2022-07-16 16:39:18 +02:00
parent 329ed34c32
commit fa8cf85c3c

View File

@ -155,13 +155,15 @@ public:
return this->remove_at(this->buffer_pos - 1); 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) { for (unsigned int i = 0; i < this->buffer_pos; ++i) {
if (this->buffer[i] == e) { if (this->buffer[i] == e) {
this->copy_left(i); this->copy_left(i);
return; return 0;
} }
} }
return -1;
} }
T get(unsigned int i) const { T get(unsigned int i) const {