mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 11:36:22 +00:00
Fix compilation of remove_at() in array.h. It was never tested before.
Make stacks' pop() return top value, not just move stack pointer. svn-id: r14565
This commit is contained in:
parent
bca746e802
commit
e31aa60730
@ -78,11 +78,9 @@ public:
|
||||
_size++;
|
||||
}
|
||||
|
||||
T& remove_at(int idx) {
|
||||
T& tmp;
|
||||
|
||||
T remove_at(int idx) {
|
||||
assert(idx >= 0 && idx < _size);
|
||||
tmp = _data[idx];
|
||||
T tmp = _data[idx];
|
||||
for (int i = idx; i < _size - 1; i++)
|
||||
_data[i] = _data[i+1];
|
||||
_size--;
|
||||
|
@ -54,9 +54,12 @@ public:
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
void pop() {
|
||||
T pop() {
|
||||
T tmp;
|
||||
assert(_size > 0);
|
||||
tmp = _stack[_size];
|
||||
_stack[--_size] = 0;
|
||||
return tmp;
|
||||
}
|
||||
int size() const {
|
||||
return _size;
|
||||
@ -94,8 +97,10 @@ public:
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
void pop() {
|
||||
T pop() {
|
||||
T tmp = top();
|
||||
_stack.remove_at(size() - 1);
|
||||
return tmp;
|
||||
}
|
||||
int size() const {
|
||||
return _stack.size();
|
||||
|
Loading…
x
Reference in New Issue
Block a user