Tools.h++ Manual

22-62 104011 Tandem Computers Incorporated
22
Program output:
May 14, 1990
June 2, 1991
August 9, 1991
August 10, 1991
September 1, 1991
September 1, 1991
Public constructor
RWTPtrSortedVector(size_t capac = RWDEFAULT_CAPACITY);
Create an empty sorted vector with an initial capacity equal to
capac
. The
vector will be automatically resized should the number of items exceed this
amount.
RWTPtrSortedVector<T>(const RWTPtrSortedVector<T>& c);
Constructs a new ordered vector as a shallow copy of
c
. After construction,
pointers will be shared between the two collections.
Public operators
RWTPtrSortedVector<T>& operator=(const
RWTPtrSortedVector& c);
Sets self to a shallow copy of
c
. Afterwards, pointers will be shared between
the two collections.
T*& operator()(size_t i);
T* operator()(size_t i) const;
Returns a pointer to the
i
'th value in the vector. The first variant can be used
as an l-value, the second cannot. The index
i
must be between zero and the
number of items in the collection less one. No bounds checking is performed.
cout << *vec[i] << endl;
vec.clearAndDestroy();
return 0;
}
Code Example 22-5 (Continued)