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_SIGN_MIXTURE_FLC_12NOV2002_HPP
0011 #define BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP
0012 
0013 #include "boost/config.hpp"
0014 #include "boost/limits.hpp"
0015 
0016 #include "boost/numeric/conversion/sign_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 'SignMixture'
0024   typedef boost::integral_constant<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
0025   typedef boost::integral_constant<sign_mixture_enum, signed_to_signed>     sig2sig_c ;
0026   typedef boost::integral_constant<sign_mixture_enum, signed_to_unsigned>   sig2unsig_c ;
0027   typedef boost::integral_constant<sign_mixture_enum, unsigned_to_signed>   unsig2sig_c ;
0028 
0029   // Metafunction:
0030   //
0031   //   get_sign_mixture<T,S>::type
0032   //
0033   // Selects the appropriate SignMixture Integral Constant for the combination T,S.
0034   //
0035   template<class T,class S>
0036   struct get_sign_mixture
0037   {
0038     typedef mpl::bool_< ::std::numeric_limits<S>::is_signed > S_signed ;
0039     typedef mpl::bool_< ::std::numeric_limits<T>::is_signed > T_signed ;
0040 
0041     typedef typename
0042       for_both<S_signed, T_signed, sig2sig_c, sig2unsig_c, unsig2sig_c, unsig2unsig_c>::type
0043         type ;
0044   } ;
0045 
0046   // Metafunction:
0047   //
0048   //   for_sign_mixture<SignMixture,Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig>::type
0049   //
0050   // {SignMixture} is one of the Integral Constants for SignMixture, declared above.
0051   // {Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig} are aribtrary types. (not metafunctions)
0052   //
0053   // According to the value of 'SignMixture', selects the corresponding type.
0054   //
0055   template<class SignMixture, class Sig2Sig, class Sig2Unsig, class Unsig2Sig, class Unsig2Unsig>
0056   struct for_sign_mixture
0057   {
0058     typedef typename
0059       ct_switch4<SignMixture
0060                  , sig2sig_c, sig2unsig_c, unsig2sig_c  // default
0061                  , Sig2Sig  , Sig2Unsig  , Unsig2Sig  , Unsig2Unsig
0062                 >::type
0063         type ;
0064   } ;
0065 
0066 } } } // namespace boost::numeric::convdetail
0067 
0068 #endif
0069 //
0070 ///////////////////////////////////////////////////////////////////////////////////////////////
0071 
0072