Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWTPtrVector<T>

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

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 pointers must 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.

Persistence

Isomorphic

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;
    delete week[i];
  }

  return 0;
}

Program output:

March 16, 1996
March 17, 1996
March 18, 1996
March 19, 1996
March 20, 1996
March 21, 1996
March 22, 1996

Public Constructors

RWTPtrVector<T>();
RWTPtrVector<T>(size_t n);
RWTPtrVector<T>(size_t n, T* ival);
RWTPtrVector<T>(const RWTPtrVector& v);

Public operators

RWTPtrVector<T>&
operator=(const RWTPtrVector<T>& v); 
RWTPtrVector<T>&
operator=(T* p); 
T*&
operator()(size_t i); 
T*
operator()(size_t i) const;
T*&
operator[](size_t i); 
T*
operator[](size_t i) const;

Public Member Functions

T* const *
data() const; 
size_t
length() const; 
void
reshape(size_t N); 
void
resize(size_t N); 


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