mirror of https://github.com/PrimeDecomp/prime.git
Improve list::clear
This commit is contained in:
parent
1a83aa2aac
commit
16cb68c709
|
@ -35,16 +35,7 @@ public:
|
|||
}
|
||||
void push_back(const T& val) { do_insert_before(x8_end, val); }
|
||||
void clear() {
|
||||
// iterator e = end();
|
||||
iterator cur = begin();
|
||||
while (cur != end()) {
|
||||
cur = erase(cur);
|
||||
}
|
||||
// node *e = x8_end;
|
||||
// node *cur = x4_start;
|
||||
// while (cur != e) {
|
||||
// cur = erase(cur);
|
||||
// }
|
||||
erase(begin(), end());
|
||||
}
|
||||
|
||||
iterator begin() { return iterator(x4_start); }
|
||||
|
@ -52,6 +43,13 @@ public:
|
|||
iterator end() { return iterator(x8_end); }
|
||||
const_iterator end() const { return const_iterator(x8_end); }
|
||||
|
||||
void erase(const iterator& start, const iterator& end) {
|
||||
iterator it = start;
|
||||
while (it != end) {
|
||||
erase(it++);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
struct node {
|
||||
node* x0_prev;
|
||||
|
|
Loading…
Reference in New Issue