Tools.h++ Manual
22-120 104011 Tandem Computers Incorporated
22
RWTValVector<T>
Synopsis
#include <rw/tvvector.h>
RWTValVector<T> vec;
Descripton Class
RWTValVector<T>
is a simple parameterized vector of 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
RWTValOrderedVector<T>
may be a better choice.
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.);
• a default constructor.
Example
#include <rw/tvvector.h>
#include <rw/rwdate.h>
#include <rw/rstream.h>
main() {
RWTValVector<RWDate> week(7);
RWDate begin; // Today's date
for (int i=0; i<7; i++)
week[i] = begin++;
for (i=0; i<7; i++)
cout << week[i] << endl;
return 0;
}