00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __ENSURE_FLOATING_HPP__
00025 #define __ENSURE_FLOATING_HPP__
00026
00027 #include <Sequence/preferFloatingTypes.hpp>
00028 #include <boost/mpl/identity.hpp>
00029
00030 namespace Sequence
00031 {
00032 template <typename T, typename T2, typename floatingType = double>
00033 struct ensureFloating
00043 {
00044 BOOST_STATIC_ASSERT( (boost::is_arithmetic<T>::value) &&
00045 (boost::is_arithmetic<T2>::value) );
00046 BOOST_STATIC_ASSERT( (boost::is_float<floatingType>::value) );
00050 typedef typename boost::mpl::if_<
00051 typename boost::mpl::not_<
00052 typename boost::is_float<typename preferFloatingTypes<T,T2>::type>
00053 >,
00054 typename boost::mpl::identity<floatingType>::type,
00055 typename preferFloatingTypes<T,T2>::type >::type type;
00056 };
00057 }
00058 #endif