CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types
PreciseFloatType< T, U > Struct Template Reference

default definition is double More...

#include <PreciseFloatType.h>

Public Types

typedef double Type
 

Detailed Description

template<typename T, typename U>
struct PreciseFloatType< T, U >

default definition is double

Defines a typeded corresponding to the more precise of the two floating point types. This is useful for mixed precision arithmetic, e.g. to determin the return type. Example of use: template <class T, class U> typename PreciseFloatType<T,U>::Type operator+( const Vector<T>& a, const Vector<U>& b) { typename PreciseFloatType<T,U>::Type result(a); // assuming constructability return a+=b; // and addition for Vector of different type. }

This implementation is very simple, it only handles float, double and long double. for all other types PreciseFloatType<T,U>::Type is double if not compared to long double, otherwise it is long double.

Definition at line 23 of file PreciseFloatType.h.

Member Typedef Documentation

template<typename T, typename U>
typedef double PreciseFloatType< T, U >::Type

Definition at line 25 of file PreciseFloatType.h.