SourcePro® API Reference Guide

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

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

#include <rw/math/mathvec.h>

Public Member Functions

 RWConvertMathVec (const RWMathVec< From > &v)
 
 operator RWMathVec< To > ()
 

Detailed Description

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

Class RWConvertMathVec converts between RWMathVec types with different datatypes.

Synopsis
template <class From, class To>
Example
#include <rw/math/mathvec.h>
int main()
{
// create a length 5 vector of 1's
// convert int vector d to a DComplex
// vector c with all real parts 1
// convert int vector d to a double vector
//and then call sin
s = sin(s);
}

Constructor & Destructor Documentation

template<class From, class To>
RWConvertMathVec< From, To >::RWConvertMathVec ( const RWMathVec< From > &  v)
inline

Constructs a new vector of type RWMathVec that can be used anywhere as a type RWMathVec. 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>
RWConvertMathVec< From, To >::operator RWMathVec< To > ( )
inline

Automatic conversion operator that enables class RWConvertMathVec to be used as an RWMathVec. While the actual conversion takes place in the constructor, this operator provides a reference to that converted vector.

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