Nonstandard Numeric Types
An important advantage of using templates for collection classes is flexibility. Templates let you create vectors, matrices, and arrays of arbitrary built-in types, and even types you define yourself. For example, you can create a matrix
RWGenMat<long double> for doing high-precision floating point calculations, or an array
RWMathArray<unsigned short int> for small integers. This flexibility gives you greater control of both accuracy and storage demands for a given application.
Unfortunately, not all compilers conform to the proposed template standards. For this reason, parts of the library are able to support only the six defined types available in earlier versions of the Essential Math Module:
DComplex,
double,
float,
int,
UChar, and
SChar. You can access the full functionality of the library with other numeric types by making a minor change in a library header file, and adding some global functions for the additional numeric types. We will show you how to do this in
Adding New Numeric Types but let us first discuss the requirements for defining a new numeric type.