Tools.h++ Manual

104011 Tandem Computers Incorporated 21-145
21
RWOrdered
RWOrdered
|
RWSequenceable
|
RWCollection
|
RWCollectable
Synopsis
#include <rw/ordcltn.h>
RWOrdered a;
Description Class
RWOrdered
represents a group of ordered items, accessible by an index
number, but not accessible by an external key. Duplicates are allowed. The
ordering of elements is determined externally, generally by the order of
insertion and removal. An object stored by
RWOrdered
must inherit from the
abstract base class
RWCollectable
.
Class
RWOrdered
is implemented as a vector of pointers, allowing for more
efficient traversing of the collection than the linked list classes
RWSlistCollectables
and
RWDlistCollectables
, but slower insertion in
the center of the collection.
Public constructors
RWOrdered(size_t size = RWDEFAULT_CAPACITY);
Construct an
RWOrdered
with an initial capacity of size.
Public member operators
RWBoolean operator==(const RWOrdered& od)
const;
Returns
TRUE
if for every item in self, the corresponding item in
od
at the same
index isEqual. The two collections must also have the same number of
members.
RWCollectable*& operator[](size_t i);
Returns the
i
'th element in the collection. If
i
is out of range, an exception of
type
RWBoundsErr
will occur. The results of this function can be used as an
lvalue.