Tools.h++ Class Reference

Table Of Contents
RWBoundsError will be thrown.
void
clear();
Removes all items from the collection.
RWBoolean
contains(const T& a) const;
Returns TRUE if the collection contains an item that is equal to a. A linear search is done.
Equality is measured by the class-defined equality operator.
const T*
data() const;
Returns a pointer to the raw data of the vector. The contents should not be changed. Should be
used with care.
size_t
entries() const;
Returns the number of items currently in the collection.
RWBoolean
find(const T& target, T& ret) const;
Performs a linear search and returns TRUE if the vector contains an object that is equal to the
object target 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 T&
first() const;
Returns the first item in the collection. An exception of type RWBoundsError 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 RWBoundsError will occur.