epoc32/include/stdapis/boost/numeric/conversion/detail/int_float_mixture.hpp
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 //  © Copyright Fernando Luis Cacciola Carballal 2000-2004
     2 //  Use, modification, and distribution is subject to the Boost Software
     3 //  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     4 //  http://www.boost.org/LICENSE_1_0.txt)
     5 
     6 //  See library home page at http://www.boost.org/libs/numeric/conversion
     7 //
     8 // Contact the author at: fernando_cacciola@hotmail.com
     9 // 
    10 #ifndef BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
    11 #define BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
    12 
    13 #include "boost/config.hpp"
    14 #include "boost/limits.hpp"
    15 
    16 #include "boost/numeric/conversion/int_float_mixture_enum.hpp"
    17 #include "boost/numeric/conversion/detail/meta.hpp"
    18 
    19 #include "boost/mpl/integral_c.hpp"
    20 
    21 namespace boost { namespace numeric { namespace convdetail
    22 {
    23   // Integral Constants for 'IntFloatMixture'
    24   typedef mpl::integral_c<int_float_mixture_enum, integral_to_integral> int2int_c ;
    25   typedef mpl::integral_c<int_float_mixture_enum, integral_to_float>    int2float_c ;
    26   typedef mpl::integral_c<int_float_mixture_enum, float_to_integral>    float2int_c ;
    27   typedef mpl::integral_c<int_float_mixture_enum, float_to_float>       float2float_c ;
    28 
    29   // Metafunction:
    30   //
    31   //   get_int_float_mixture<T,S>::type
    32   //
    33   // Selects the appropriate Int-Float Mixture Integral Constant for the combination T,S.
    34   //
    35   template<class T,class S>
    36   struct get_int_float_mixture
    37   {
    38     typedef mpl::bool_< ::std::numeric_limits<S>::is_integer > S_int ;
    39     typedef mpl::bool_< ::std::numeric_limits<T>::is_integer > T_int ;
    40 
    41     typedef typename
    42       for_both<S_int, T_int, int2int_c, int2float_c, float2int_c, float2float_c>::type
    43         type ;
    44   } ;
    45 
    46   // Metafunction:
    47   //
    48   //   for_int_float_mixture<Mixture,int_int,int_float,float_int,float_float>::type
    49   //
    50   // {Mixture} is one of the Integral Constants for Mixture, declared above.
    51   // {int_int,int_float,float_int,float_float} are aribtrary types. (not metafunctions)
    52   //
    53   // According to the value of 'IntFloatMixture', selects the corresponding type.
    54   //
    55   template<class IntFloatMixture, class Int2Int, class Int2Float, class Float2Int, class Float2Float>
    56   struct for_int_float_mixture
    57   {
    58     typedef typename
    59       ct_switch4<IntFloatMixture
    60                  ,int2int_c, int2float_c, float2int_c  // default
    61                  ,Int2Int  , Int2Float  , Float2Int  , Float2Float
    62                 >::type
    63         type ;
    64   } ;
    65 
    66 } } } // namespace boost::numeric::convdetail
    67 
    68 #endif
    69 //
    70 ///////////////////////////////////////////////////////////////////////////////////////////////
    71 
    72