Helper Class Member Functions
Each of the helper classes has three important member functions:
constructor. The constructor requires a reference to a
double, that is, a
double&, and one or two
bool parameters specifying how to treat the reference. For example, a
RWRORef<double> takes a parameter that tells whether or not the reference must be considered read-only.
operator double(). This type conversion operator is invoked by the compiler as necessary to return the double referenced by the class for use as a right-side value. It may have to modify the value as necessary (for example, to take its conjugate).
operator=(double x). This function changes the double referenced by the class to the value
x, after modifying
x if necessary (for example, by taking its conjugate). If the reference is supposed to be read-only, a runtime error occurs.
Normally the Linear Algebra Module uses these helper classes transparently. You simply use the subscripting operator in the natural and intuitive way. Occasionally, however, using these helper classes creates a situation too complex for some C++ compilers to handle, and a compiler may emit a compile-time error, or simply crash. In these cases, we recommend using the member functions val() and set(), which are easier for the compiler to handle because they do not require the use of a helper class.