|
VMS Help CXXL, vector_package *Conan The Librarian |
The vector package provides ways to define vectors or stacks of
objects of any type by using the macro expansion capability of the DEC
C++ preprocessor. When used with pointers, the vector package becomes
a versatile tool for constructing programs to solve complicated
mathematical problems.
Header:
#include <vector.hxx>
To declare a generic vector:
1. Include the vector.hxx header in your program and declare the
vector class as follows:
declare(vector, TYPE)
TYPE may be any other valid C++ type name. Make sure you define
the declare macro in every file that references this new vector
data type.
2. Expand the implementation of all function bodies as follows:
implement(vector, TYPE)
This implement macro must appear once in a program.
3. Declare objects of type vector, TYPE, and use the index operator
to reference these objects. The following is an example of
declaration and referencing:
class MyType {//...//};
declare(vector,MyType);
implement(vector,MyType);
vector(MyType) vec1(100), vec2(5);
MyType x,y;
//...
if(vec2[4] == y vec1[98]) = x;
The TYPE parameter must be an identifier. If it is not a class
name, a fundamental type, or a type name, use a typedef to
create a name for the type. For example:
typedef char * PCHAR;
declare (stack,PCHAR);
stack(PCHAR) ptrstack;
char *p = "Text";
ptrstack.push(p);
Additional Information (explode) :
|
|