preferFloatingTypes< T, T2 > Struct Template Reference
[Metaprogramming]

#include <Sequence/preferFloatingTypes.hpp>


Detailed Description

template<typename T, typename T2>
struct preferFloatingTypes< T, T2 >

This class contains a public member "type", which is a typedef. What type is a typedef for is determined as follows: When instantiated with two types, T and T2, if T or T2 is double, type is double. Else, if either T or T2 is float, and the other type is non-floating, type is float. If both T and T2 are non-floating, type is T. For example:

    std::cout << typeid(Sequence::preferFloatingTypes<float,double>::type).name ()
    << std::endl
    << typeid(Sequence::preferFloatingTypes<double,float>::type).name()
    << std::endl
    << typeid(Sequence::preferFloatingTypes<double,int>::type).name()
    << std::endl
    << tpyeid(Sequence::preferFloatingTypes<float,int>::type).name()
    << std::endl
    << typeid(Sequence::preferFloatingTypes<int,unsigned>::type).name()
    << std::endl;
Note:
Type selection is done using the BOOST metaprogramming library (mpl). See http://www.boost.org for details and mpl documentation. Also, if T or T2 are not arithmetic types, compilation will fail, and this requirement is enforced via BOOST_STATIC_ASSERT( (boost::is_arithmetic<T>::value) && (boost::is_arithmetic<T2>::value) ).

Definition at line 39 of file preferFloatingTypes.hpp.


The documentation for this struct was generated from the following file:
Generated on Thu Aug 11 13:22:01 2011 for libsequence by  doxygen 1.6.3