Tools.h++ Manual

23-14 104011 Tandem Computers Incorporated
23
Public member functions
val operator()(size_t i) const;
val& operator()(size_t i);
Return the i'th value in the vector. The index
i
must be between 0 and the
length of the vector less one. No bounds checking is performed. The second
variant can be used as an lvalue, the first cannot.
val operator[](size_t i) const;
val& operator[](size_t i);
Return the i'th value in the vector. The index
i
must be between 0 and the
length of the vector less one. Bounds checking will be performed. The second
variant can be used as an lvalue, the first cannot.
void clear();
Remove all items from the collection.
size_t entries() const;
Return the number of items currently in the collection.
size_t index(
val item
) const;
Performs a linear search of the collection returning the index of the first item
that isEqual to the argument
item
. If no item is found, then it returns
RW_NPOS
.
void insert(
val item
);
Add the new value item to the end of the collection.
v
oid insertAt(size_t indx, val item);
Add the new value
item
to the collection at position
indx
. The value of
indx
must be between zero and the length of the collection. No bounds checking is
performed. Old items from index
indx
upwards will be shifted to higher
indices.
RWBoolean isEmpty() const;
Return
TRUE
if the collection has no entries.
FALSE
otherwise.
void removeAt(size_t indx);
Remove the item at position
indx
from the collection. The value of
indx
must
be between zero and the length of the collection less one. No bounds checking
is performed. Old items from index
indx+1
will be shifted to lower indices.
E.g., the item at index
indx+1
will be moved to position
indx
, etc.