Tools.h++ Manual
22-100 104011 Tandem Computers Incorporated
22
RWTValOrderedVector<T>
Synopsis
#include <rw/tvordvec.h>
RWTValOrderedVector<T> ordvec;
Description
RWTValOrderedVector<T>
is an ordered collection. That is, the items in the
collection have a meaningful ordered relationship with respect to one another
and can be accessed by an index number. The order is set by the order of
insertion. Duplicates are allowed. The class is implemented as a vector,
allowing efficient insertion and retrieval from the end of the collection, but
somewhat slower from the beginning of the collection.
The class
T
must have:
• well-defined copy semantics (
T::T(const T&)
or equiv.);
• well-defined assignment semantics (
T::operator=(const T&)
or equiv.);
• well-defined equality semantics (
T::operator==(const T&)
);
• a default constructor.
Note that an ordered vector has a length (the number of items returned by
length()
or
entries()
) and a capacity. Necessarily, the capacity is always
greater than or equal to the length. Although elements beyond the collection's
length are not used, nevertheless, in a value-based collection, they are
occupied. If each instance of class
T
requires considerable resources, then you
should insure that the collection's capacity is not much greater than its length,
otherwise unnecessary resources will be tied up.