Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:46

0001 //  (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
0002 //  Use, modification, and distribution is subject to the Boost Software
0003 //  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0004 //  http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 //  See library home page at http://www.boost.org/libs/numeric/conversion
0007 //
0008 // Contact the author at: fernando_cacciola@hotmail.com
0009 // 
0010 #ifndef BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
0011 #define BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
0012 
0013 #include "boost/config.hpp"
0014 #include "boost/limits.hpp"
0015 
0016 #include "boost/numeric/conversion/int_float_mixture_enum.hpp"
0017 #include "boost/numeric/conversion/detail/meta.hpp"
0018 
0019 #include "boost/type_traits/integral_constant.hpp"
0020 
0021 namespace boost { namespace numeric { namespace convdetail
0022 {
0023   // Integral Constants for 'IntFloatMixture'
0024   typedef boost::integral_constant<int_float_mixture_enum, integral_to_integral> int2int_c ;
0025   typedef boost::integral_constant<int_float_mixture_enum, integral_to_float>    int2float_c ;
0026   typedef boost::integral_constant<int_float_mixture_enum, float_to_integral>    float2int_c ;
0027   typedef boost::integral_constant<int_float_mixture_enum, float_to_float>       float2float_c ;
0028 
0029   // Metafunction:
0030   //
0031   //   get_int_float_mixture<T,S>::type
0032   //
0033   // Selects the appropriate Int-Float Mixture Integral Constant for the combination T,S.
0034   //
0035   template<class T,class S>
0036   struct get_int_float_mixture
0037   {
0038     typedef mpl::bool_< ::std::numeric_limits<S>::is_integer > S_int ;
0039     typedef mpl::bool_< ::std::numeric_limits<T>::is_integer > T_int ;
0040 
0041     typedef typename
0042       for_both<S_int, T_int, int2int_c, int2float_c, float2int_c, float2float_c>::type
0043         type ;
0044   } ;
0045 
0046   // Metafunction:
0047   //
0048   //   for_int_float_mixture<Mixture,int_int,int_float,float_int,float_float>::type
0049   //
0050   // {Mixture} is one of the Integral Constants for Mixture, declared above.
0051   // {int_int,int_float,float_int,float_float} are aribtrary types. (not metafunctions)
0052   //
0053   // According to the value of 'IntFloatMixture', selects the corresponding type.
0054   //
0055   template<class IntFloatMixture, class Int2Int, class Int2Float, class Float2Int, class Float2Float>
0056   struct for_int_float_mixture
0057   {
0058     typedef typename
0059       ct_switch4<IntFloatMixture
0060                  ,int2int_c, int2float_c, float2int_c  // default
0061                  ,Int2Int  , Int2Float  , Float2Int  , Float2Float
0062                 >::type
0063         type ;
0064   } ;
0065 
0066 } } } // namespace boost::numeric::convdetail
0067 
0068 #endif
0069 //
0070 ///////////////////////////////////////////////////////////////////////////////////////////////
0071 
0072