Add a contains method to Queue.

This commit is contained in:
Andreas Gal 2008-08-06 19:06:37 -07:00
parent 3785f2a5af
commit 6bb6800be5

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