rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWConvertMathArray< From, To > Struct Template Reference
[Math Collections]

Converts between RWMathArray types with different datatypes. More...

#include <rw/math/mtharray.h>

List of all members.

Public Member Functions

 RWConvertMathArray (const RWMathArray< From > &v)
 operator RWMathArray< To > ()

Detailed Description

template<class From, class To>
struct RWConvertMathArray< From, To >

Class RWConvertMathArray<From,To> converts between RWMathArray types with different datatypes.

Synopsis

 template <class From, class To>
 class RWConvertMathArray;

Examples

 #include <rw/math/mtharray.h>
 
 int 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
    RWMathArray<double>
    s = RWConvertMathArray<int,double>(d);
    s = sin(s);
 }

Constructor & Destructor Documentation

template<class From, class To>
RWConvertMathArray< From, To >::RWConvertMathArray ( const RWMathArray< From > &  v  )  [inline]

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.


Member Function Documentation

template<class From, class To>
RWConvertMathArray< From, To >::operator RWMathArray< To > (  )  [inline]

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.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.