SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWConvertMathArray< From, To > Struct Template Reference

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

#include <rw/math/mtharray.h>

Public Member Functions

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

Detailed Description

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

Class RWConvertMathArray converts between RWMathArray types with different datatypes.

Synopsis
template <class From, class To>
Example
#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
// convert int array d to a double
// array and then call sin function
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 that can be used anywhere as a type RWMathArray. 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 to be used as an RWMathArray. While the actual conversion takes place in the constructor, this operator provides a reference to that converted array.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.