Tools.h++ Manual
22-66 104011 Tandem Computers Incorporated
22
RWTPtrVector<T>
Synopsis
#include <rw/tpvector.h>
RWTPtrVector<T> vec;
Descripton Class
RWTPtrVector<T>
is a simple parameterized vector of pointers to
objects of type
T
. It is most useful when you know precisely how many objects
have to be held in the collection. If the intention is to "insert" an unknown
number of objects into a collection, then class
RWTPtrOrderedVector<T>
may be a better choice.
The class
T
can be of any type.
Example
#include <rw/tpvector.h>
#include <rw/rwdate.h>
#include <rw/rstream.h>
main() {
RWTPtrVector<RWDate> week(7);
RWDate begin; // Today's date
for (int i=0; i<7; i++)
week[i] = new RWDate(begin++);
for (i=0; i<7; i++)
cout << *week[i] << endl;
return 0;
}