From f52a0df4223ec7d2524c273d403f12b155768d7a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 28 Apr 2009 10:23:26 +0000 Subject: COMMON: Made Common::List::clear more efficient svn-id: r40172 --- common/list.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/list.h b/common/list.h index b05a2b4e16..4b5d95df0d 100644 --- a/common/list.h +++ b/common/list.h @@ -192,7 +192,15 @@ public: } void clear() { - erase(begin(), end()); + NodeBase *pos = _anchor._next; + while (pos != &_anchor) { + Node *node = static_cast(pos); + pos = pos->_next; + delete node; + } + + _anchor._prev = &_anchor; + _anchor._next = &_anchor; } bool empty() const { -- cgit v1.2.3