Data Types | |
operator |
template <class From, class To> class RWConvertMathArray;
Class RWConvertMathArray<From,To> converts between RWMathArrays with different datatypes.
#include <rw/math/mtharray.h> main() { // create a 5x5x5x5 array of 1's RWMathArray<int> d(5,5,5,5,1); // convert int array d to DComplex // array c with all real parts 1 RWMathArray<DComplex> c = RWConvertMathArray<int,DComplex>(d); // convert int array d to a double // array and then call sin function function RWMathArray<double> s = RWConvertMathArray<int,double>(d); s = sin(s); }
RWConvertMathArray<From,To>(const RWMathArray<From>& M);
Constructs a new array of type RWMathArray<To> that can be used anywhere as a type RWMathArray<To>. Note that a temporary array is created every time this constructor is invoked, but the conversion operator below can be used repeatedly without creating additional temporaries.
operator RWMathArray<To>();
Automatic conversion operator that enables the class RWConvertMathArray<From,To> to be used as an RWMathArray<To>. While the actual conversion takes place in the constructor, this operator provides a reference to that converted array.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.