epoc32/include/stdapis/boost/numeric/conversion/detail/udt_builtin_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_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
    11 #define BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
    12 
    13 #include "boost/type_traits/is_arithmetic.hpp"
    14 
    15 #include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp"
    16 #include "boost/numeric/conversion/detail/meta.hpp"
    17 
    18 #include "boost/mpl/integral_c.hpp"
    19 
    20 namespace boost { namespace numeric { namespace convdetail
    21 {
    22   // Integral Constants for 'UdtMixture'
    23   typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
    24   typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_udt>     builtin2udt_c ;
    25   typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_builtin>     udt2builtin_c ;
    26   typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_udt>         udt2udt_c ;
    27 
    28   // Metafunction:
    29   //
    30   //   for_udt_mixture<UdtMixture,BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt>::type
    31   //
    32   // {UdtMixture} is one of the Integral Constants for UdMixture, declared above.
    33   // {BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt} are aribtrary types. (not metafunctions)
    34   //
    35   // According to the value of 'UdtMixture', selects the corresponding type.
    36   //
    37   template<class UdtMixture, class BuiltIn2BuiltIn, class BuiltIn2Udt, class Udt2BuiltIn, class Udt2Udt>
    38   struct for_udt_builtin_mixture
    39   {
    40     typedef typename
    41       ct_switch4<UdtMixture
    42                  , builtin2builtin_c, builtin2udt_c, udt2builtin_c // default
    43                  , BuiltIn2BuiltIn  , BuiltIn2Udt  , Udt2BuiltIn  , Udt2Udt
    44                 >::type
    45         type ;
    46   } ;
    47 
    48   // Metafunction:
    49   //
    50   //   get_udt_mixture<T,S>::type
    51   //
    52   // Selects the appropriate UdtMixture Integral Constant for the combination T,S.
    53   //
    54   template<class T,class S>
    55   struct get_udt_builtin_mixture
    56   {
    57     typedef is_arithmetic<S> S_builtin ;
    58     typedef is_arithmetic<T> T_builtin ;
    59 
    60     typedef typename
    61       for_both<S_builtin, T_builtin, builtin2builtin_c, builtin2udt_c, udt2builtin_c, udt2udt_c>::type
    62         type ;
    63   } ;
    64 
    65 } } } // namespace boost::numeric::convdetail
    66 
    67 #endif
    68 
    69