Back to home page

EIC code displayed by LXR

 
 

    


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

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_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
0011 #define BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
0012 
0013 #include "boost/type_traits/is_arithmetic.hpp"
0014 
0015 #include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp"
0016 #include "boost/numeric/conversion/detail/meta.hpp"
0017 
0018 #include "boost/type_traits/integral_constant.hpp"
0019 
0020 namespace boost { namespace numeric { namespace convdetail
0021 {
0022   // Integral Constants for 'UdtMixture'
0023   typedef boost::integral_constant<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
0024   typedef boost::integral_constant<udt_builtin_mixture_enum, builtin_to_udt>     builtin2udt_c ;
0025   typedef boost::integral_constant<udt_builtin_mixture_enum, udt_to_builtin>     udt2builtin_c ;
0026   typedef boost::integral_constant<udt_builtin_mixture_enum, udt_to_udt>         udt2udt_c ;
0027 
0028   // Metafunction:
0029   //
0030   //   for_udt_mixture<UdtMixture,BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt>::type
0031   //
0032   // {UdtMixture} is one of the Integral Constants for UdMixture, declared above.
0033   // {BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt} are aribtrary types. (not metafunctions)
0034   //
0035   // According to the value of 'UdtMixture', selects the corresponding type.
0036   //
0037   template<class UdtMixture, class BuiltIn2BuiltIn, class BuiltIn2Udt, class Udt2BuiltIn, class Udt2Udt>
0038   struct for_udt_builtin_mixture
0039   {
0040     typedef typename
0041       ct_switch4<UdtMixture
0042                  , builtin2builtin_c, builtin2udt_c, udt2builtin_c // default
0043                  , BuiltIn2BuiltIn  , BuiltIn2Udt  , Udt2BuiltIn  , Udt2Udt
0044                 >::type
0045         type ;
0046   } ;
0047 
0048   // Metafunction:
0049   //
0050   //   get_udt_mixture<T,S>::type
0051   //
0052   // Selects the appropriate UdtMixture Integral Constant for the combination T,S.
0053   //
0054   template<class T,class S>
0055   struct get_udt_builtin_mixture
0056   {
0057     typedef is_arithmetic<S> S_builtin ;
0058     typedef is_arithmetic<T> T_builtin ;
0059 
0060     typedef typename
0061       for_both<S_builtin, T_builtin, builtin2builtin_c, builtin2udt_c, udt2builtin_c, udt2udt_c>::type
0062         type ;
0063   } ;
0064 
0065 } } } // namespace boost::numeric::convdetail
0066 
0067 #endif
0068 
0069