Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWGVector(val)

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/gvector.h>
declare(RWGVector,val)
implement(RWGVector,val)

RWGVector(val) a;   // A Vector of val's.

Description

Class RWGVector(val) represents a group of ordered elements, accessible by an index. Duplicates are allowed. This class is implemented as an array. Objects of type RWGVector(val) are declared with macros defined in the standard C++ header file <generic.h>.

Note that it is a value-based collection: items are copied in and out of the collection.

The class val must have:

For each type of RWGVector, you must include one (and only one) call to the macro implement, somewhere in your code.

Persistence

None

Example

#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;
}

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)();
RWGVector(val)(size_t n);
RWGVector(val)(size_t n, val v);
RWGVector(val)(RWGVector(val)& s);

Public Member Operators

RWGVector(val)&
operator=(RWGVector(val)& s);
RWGVector(val)&
operator=(val v);
val
operator()(size_t i) const;
val&
operator()(size_t i);
val
operator[](size_t i) const;
val&
operator[](size_t i);

Public Member Functions

const val*
data() const;
size_t
length() const;
void
reshape(size_t n);


Previous fileTop of documentContentsIndexNext file
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.