Tools.h++ Manual

23-12 104011 Tandem Computers Incorporated
23
RWGOrderedVector(val)
Synopsis
#include <rw/gordvec.h>
declare(RWGVector,
val
)
declare(RWGOrderedVector,
val
)
implement(RWGVector,
val
)
implement(RWGOrderedVector,
val
)
RWGOrderedVector
(val)
v; // Ordered vector of objects of
type
val
.
Description Class
RWGOrderedVector
(val ) represents an ordered collection of objects of
type val. Objects are ordered by the order of insertion and are accessible by
index. Duplicates are allowed.
RWGOrderedVector
(val) is implemented as a
vector, using macros defined in the standard C++ header file <generic.h>.
Note – It is a value-based collection: items are copied in and out of the
collection.
The class val must have:
a default constructor;
well-defined copy semantics
(
val
::
val
(const
val
&)
or equiv.);
well-defined assignment semantics
(
val
::operator=(const
val
&)
or equiv.);
well-defined equality semantics
(
val
::operator==(const
val
&)
or equiv.).
To use this class you must declare and implement its base class as well as the
class itself. For example, here is how you declare and implement an ordered
collection of doubles:
declare(RWGVector,double) // Declare base class
declare(RWGOrderedVector,double) // Declare ordered vector
// In one and only one
.cc
file you must put the following:
implement(RWGVector,double) // Implement base class
implement(RWGOrderedVector,double) // Implement ordered
vector