Add a contains method to Queue.

This commit is contained in:
Andreas Gal 2008-08-06 19:06:37 -07:00
parent 9c88e4b9fb
commit 2d0cef9e4a

View File

@ -87,6 +87,13 @@ public:
free(_data);
}
bool contains(T a) {
for (unsigned n = 0; n < _len; ++n)
if (_data[n] == a)
return true;
return false;
}
void add(T a) {
JS_ASSERT(_len <= _max);
ensure(_len + 1);