Tools.h++ Manual
104011 Tandem Computers Incorporated 22-117
22
Public operators
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
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 binary
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& a,T& ret) const;
Performs a binary 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.