Tools.h++ Manual
104011 Tandem Computers Incorporated 23-33
23
Example
Program output:
04/12/93
04/13/93
04/14/93
04/15/93
04/16/93
04/17/93
04/18/93
Public constructors
RWGVector(
val
)();
Construct an empty vector.
RWGVector(
val
)(size_t n);
Construct a vector with length
n
. The initial values of the elements can (and
probably will) be garbage.
RWGVector(
val
)(size_t n,
val
v);
Construct a vector with length
n
. Each element is assigned the value
v
.
#include <rw/gvector.h>
#include <rw/rwdate.h>
#include <rw/rstream.h>
declare(RWGVector, RWDate) /* Declare a vector of dates */
implement(RWGVector, RWDate) /* Implement a vector of dates */
main()
{
RWGVector(RWDate) oneWeek(7);
for (int i=1; i<7; i++)
oneWeek(i) = oneWeek(0) + i;
for (i=0; i<7; i++)
cout << oneWeek(i) << endl;
return 0;
}