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:
parent
83a9be236a
commit
576813ea37
@ -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<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>
|
||||
Element&
|
||||
Array<Element>::ElementAt(int index)
|
||||
|
Loading…
Reference in New Issue
Block a user