Tools.h++ Manual

22-102 104011 Tandem Computers Incorporated
22
Public operators
RWTValOrderedVector<T>& operator=(const
RWTValOrderedVector& c);
Sets self to a copy of
c
. The copy constructor of all elements in the vector will
be called. Self will have the same capacity and number of members as the old
vector.
T& operator()(size_t i);
T operator()(size_t i) const;
Returns the
i
'th value in the vector. The first variant can be used as an l-value,
the second cannot. The index
i
must be between zero and the number of items
in the collection less one. No bounds checking is performed.
T& operator[](size_t i);
T operator[](size_t i) const;
Returns the
i
'th value in the vector. The first variant can be used as an l-value,
the second cannot. The index
i
must be between zero and the number of items
in the collection less one, or an exception of type
TOOL_INDEX
will be thrown.
Public member functions
void append(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.
T& at(size_t i);
T at(size_t i) const;
Return the
i
'th value in the vector. The first variant can be used as an lvalue,
the second cannot. The index
i
must be between 0 and the length of the vector
less one, or an exception of type
TOOL_INDEX
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.