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:
Eugene Sandulenko 2004-08-12 21:33:59 +00:00
parent bca746e802
commit e31aa60730
2 changed files with 9 additions and 6 deletions

View File

@ -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--;

View File

@ -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();