Tools.h++ Manual
22-118 104011 Tandem Computers Incorporated
22
size_t index(const T& a) const;
Performs a binary search, returning the index of the first item that is equal to
a
.
Returns
RW_NPOS
if there is no such item. Equality is measured by the class-
defined equality operator.
void insert(const T& a);
Performs a binary search, inserting a after all items that compare less than or
equal to it, but before all items that do not. "Less Than" is measured by the
class-defined '<' operator for type
T
. The collection will be resized
automatically if this causes the number of items to exceed the capacity.
RWBoolean isEmpty() const;
Returns
TRUE
if there are no items in the collection,
FALSE
otherwise.
T last() const;
Returns 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(const T& a) const;
Performs a binary search, returning the number of items that are equal to
a
.
Equality is measured by the class-defined equality operator.
RWBoolean remove(const T& a);
Performs a binary search, removing the first object which is equal to the object
a
and returns
TRUE
. Returns
FALSE
if there is no such object. Equality is
measured by the class-defined equality operator.
size_t removeAll(const T& a);
Removes all items which are equal to
a
, returning the number removed.
Equality is measured by the class-defined equality operator.
T removeAt(size_t i);
Removes and returns the object at index
i
. 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.
T removeFirst();
Removes and returns the first object in the collection. An exception of type
TOOL_INDEX
will be thrown if the list is empty.