Skip to content

Commit eca23da

Browse files
jesse99brson
authored andcommitted
Instead of returning a bool (which everyone ignored) pop asserts
1 parent 6bab226 commit eca23da

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/rt/util/array_list.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ template<typename T> class array_list {
3535
size_t size() const;
3636
int32_t append(T value);
3737
int32_t push(T value);
38-
bool pop(T *value);
38+
void pop(T *value);
3939
bool replace(T old_value, T new_value);
4040
int32_t index_of(T value) const;
4141
bool is_empty() const;
@@ -81,17 +81,14 @@ array_list<T>::push(T value) {
8181
return _size - 1;
8282
}
8383

84-
template<typename T> bool
84+
template<typename T> void
8585
array_list<T>::pop(T *value) {
86-
if (_size == 0) {
87-
return false;
88-
}
86+
assert(_size > 0);
8987
if (value != NULL) {
9088
*value = _data[-- _size];
9189
} else {
9290
-- _size;
9391
}
94-
return true;
9592
}
9693

9794
/**

0 commit comments

Comments
 (0)