Tools.h++ Class Reference

Table Of Contents
void
clear();
Removes all items from the collection.
void
clearAndDestroy();
Removes all items from the collection and deletes them.
RWBoolean
contains(const 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(const T* target) const;
Returns a pointer to the first object encountered which is equal to the object pointed to by target,
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* const&
first() const;
Returns a pointer to the first item in the vector. An exception of type RWBoundsError will occur
if the vector is empty.
size_t
index(const T* a) const;
Performs a binary search, returning the index of the first object that is equal to the object pointed
to by a, or RW_NPOS if there is no such object. Equality is measured by the class-defined
equality operator for type T.
void
insert(T* a);
Performs a binary search, inserting the object pointed to by a after all items that compare less
than or equal to it, but before all items that do not. "Less than" is measured by the class-defined
'<' operator for type T. The collection will be resized automatically if this causes the number of
items to exceed the capacity.
RWBoolean
isEmpty() const;