Tools.h++ Manual
22-50 104011 Tandem Computers Incorporated
22
void insertAt(size_t i, T* a);
Adds the object pointed to by a at the index position 
i
. The item previously at 
position 
i 
is moved to 
i+1
, etc. The collection will be resized automatically if 
this causes the number of items to exceed the capacity. The index 
i 
must be 
between 0 and the number of items in the vector or an exception of type 
TOOL_INDEX 
will occur. 
RWBoolean isEmpty() const;
Returns 
TRUE 
if there are no items in the collection, 
FALSE 
otherwise.
T* last() const;
Returns a pointer to the last item in the collection. If there are no items in the 
collection then an exception of type 
TOOL_INDEX 
will occur.
size_t length() const;
Returns the number of items currently in the collection.
size_t occurrencesOf(T* a) const;
Performs a linear search, returning the number of objects in the collection that 
are equal to the object pointed to by 
a
. Equality is measured by the class-
defined equality operator for type 
T
.
void prepend(T* a);
Adds the item pointed to by 
a 
to the beginning of the collection. The collection 
will be resized automatically if this causes the number of items to exceed the 
capacity.
T* remove(T* a);
Performs a linear search, removing the first object which is equal to the object 
pointed to by 
a 
and returns a pointer to it, or nil if no such object could be 
found. Equality is measured by the class-defined equality operator for type 
T
.
size_t removeAll(T* a);
Performs a linear search, removing all objects which are equal to the object 
pointed to by 
a
. Returns the number of objects removed. Equality is measured 
by the class-defined equality operator for type 
T
.
T* removeAt(size_t i);
Removes the object at index 
i 
and returns a pointer to it. An exception of type 
TOOL_INDEX 
will be thrown if 
i 
is not a valid index. Valid indices are from 
zero to the number of items in the list less one.










