Tools.h++ Manual
104011 Tandem Computers Incorporated 22-103
22
RWBoolean find(const T& a,T& ret) const;
Performs a linear search and returns
TRUE
if the vector contains an object that
is equal to the object a and puts a copy of the matching object into
ret
.
Returns
FALSE
otherwise and does not touch
ret
. Equality is measured by the
class-defined equality operator.
T first() const;
Returns the first item in the collection. An exception of type
TOOL_INDEX
will
occur if the vector is empty.
size_t index(const T& a) const;
Performs a linear 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);
Appends the value
a
to the end of the vector. The collection will automatically
be resized if this causes the number of items in the collection to exceed the
capacity.
void insertAt(size_t i, const T& a);
Inserts the value a into the vector at index
i
. The item previously at position
i
is moved to
i+1
, etc. The collection will automatically be resized if this causes
the number of items in the collection 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 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 linear search, returning the number of items that are equal to
a
.
Equality is measured by the class-defined equality operator.