Data Types | |
operator |
template <class From, class To> class RWConvertMathVec;
Class RWConvertMathVec<From,To> converts between RWMathVecs with different datatypes.
#include <rw/math/mathvec.h> main() { // create a length 5 vector of 1's RWMathVec<int> d(5,1); // convert int vector d to a DComplex // vector c with all real parts 1 RWMathVec<DComplex> c = RWConvertMathVec<int,DComplex>(d); // convert int vector d to a double vector //and then call sin function RWMathVec<double> s = RWConvertMathVec<int,double>(d); s = sin(s); }
RWConvertMathVec<From,To>(const RWMathVec<From>& M);
Constructs a new vector of type RWMathVec<To> that can be used anywhere as a type RWMathVec<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 RWMathVec<To>();
Automatic conversion operator that enables class RWConvertMathVec<From,To> to be used as an RWMathVec<To>. While the actual conversion takes place in the constructor, this operator provides a reference to that converted vector.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.