Tools.h++ Manual

104011 Tandem Computers Incorporated 22-63
22
T*& operator[](size_t i);
T* operator[](size_t i) const;
Returns a pointer to 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;
Returns a pointer to 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.
void clear();
Removes all items from the collection.
void clearAndDestroy();
Removes all items from the collection and calls their destructors.
RWBoolean contains(T* a) const;
Returns
TRUE
if the collection contains an item that is equal to the object
pointed to by
a
,
FALSE
otherwise. A binary search is done. Equality is
measured by the class-defined equality operator for type
T
.
T* const * 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.
T* find(T* a) const;
Returns a pointer to the first object encountered which is equal to the object
pointed to by
a
, or nil if no such object can be found. A binary search is used.
Equality is measured by the class-defined equality operator for type
T
.
T* first() const;
Returns a pointer to the first item in the vector. An exception of type
TOOL_INDEX
will occur if the vector is empty.