Added Clear()/MakeEmpty() methods.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31072 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-06-16 21:41:59 +00:00
parent 83a9be236a
commit 576813ea37

View File

@ -25,6 +25,9 @@ public:
inline bool Insert(const Element& element, int index); inline bool Insert(const Element& element, int index);
inline bool Remove(int index); inline bool Remove(int index);
void Clear();
inline void MakeEmpty();
inline Element& ElementAt(int index); inline Element& ElementAt(int index);
inline const Element& ElementAt(int index) const; inline const Element& ElementAt(int index) const;
@ -119,6 +122,29 @@ Array<Element>::Remove(int index)
} }
template<typename Element>
void
Array<Element>::Clear()
{
if (fSize == 0)
return;
free(fElements);
fElements = NULL;
fSize = 0;
fCapacity = 0;
}
template<typename Element>
void
Array<Element>::MakeEmpty()
{
Clear();
}
template<typename Element> template<typename Element>
Element& Element&
Array<Element>::ElementAt(int index) Array<Element>::ElementAt(int index)