10 template<
class ItemType>
15 template<
class ItemType>
21 template<
class ItemType>
24 return itemCount == 0;
27 template<
class ItemType>
30 bool hasRoomToAdd = (itemCount < maxItems);
33 items[itemCount] = newEntry;
40 template<
class ItemType>
43 int locatedIndex = getIndexOf(anEntry);
44 bool canRemoveItem = !isEmpty() && (locatedIndex > -1);
48 items[locatedIndex] = items[itemCount];
54 template<
class ItemType>
60 template<
class ItemType>
65 while (curIndex < itemCount)
67 if (items[curIndex] == anEntry)
78 template<
class ItemType>
81 return getIndexOf(anEntry) > -1;
84 template<
class ItemType>
87 std::vector<ItemType> bagContents;
88 for (
int i = 0; i < itemCount; i++)
89 bagContents.push_back(items[i]);
95 template<
class ItemType>
103 while (!found && (searchIndex < itemCount))
105 if (items[searchIndex] == target)
108 result = searchIndex;