From 576813ea3775742d6924690436af5170af0feb9e Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 16 Jun 2009 21:41:59 +0000 Subject: [PATCH] Added Clear()/MakeEmpty() methods. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31072 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/Array.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/apps/debugger/Array.h b/src/apps/debugger/Array.h index 09d1646150..ba6dd180d3 100644 --- a/src/apps/debugger/Array.h +++ b/src/apps/debugger/Array.h @@ -25,6 +25,9 @@ public: inline bool Insert(const Element& element, int index); inline bool Remove(int index); + void Clear(); + inline void MakeEmpty(); + inline Element& ElementAt(int index); inline const Element& ElementAt(int index) const; @@ -119,6 +122,29 @@ Array::Remove(int index) } +template +void +Array::Clear() +{ + if (fSize == 0) + return; + + free(fElements); + + fElements = NULL; + fSize = 0; + fCapacity = 0; +} + + +template +void +Array::MakeEmpty() +{ + Clear(); +} + + template Element& Array::ElementAt(int index)