mirror of https://github.com/stella-emu/stella.git
Removed redundant code in Array class.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2441 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
1dbefe043d
commit
1bcdbbd3f8
|
@ -71,15 +71,6 @@ class Array
|
||||||
_data[_size++] = array._data[i];
|
_data[_size++] = array._data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void push_back_unique(const T& element)
|
|
||||||
{
|
|
||||||
if(!contains(element))
|
|
||||||
{
|
|
||||||
ensureCapacity(_size + 1);
|
|
||||||
_data[_size++] = element;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void insert_at(int idx, const T& element)
|
void insert_at(int idx, const T& element)
|
||||||
{
|
{
|
||||||
assert(idx >= 0 && idx <= _size);
|
assert(idx >= 0 && idx <= _size);
|
||||||
|
@ -171,15 +162,6 @@ class Array
|
||||||
return _data + _size;
|
return _data + _size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool contains(const T &key) const
|
|
||||||
{
|
|
||||||
for (const_iterator i = begin(); i != end(); ++i) {
|
|
||||||
if (*i == key)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ensureCapacity(int new_len)
|
void ensureCapacity(int new_len)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue