epoc32/include/stdapis/boost/numeric/conversion/detail/sign_mixture.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/numeric/conversion/detail/sign_mixture.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,72 @@
     1.4 +//  © Copyright Fernando Luis Cacciola Carballal 2000-2004
     1.5 +//  Use, modification, and distribution is subject to the Boost Software
     1.6 +//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     1.7 +//  http://www.boost.org/LICENSE_1_0.txt)
     1.8 +
     1.9 +//  See library home page at http://www.boost.org/libs/numeric/conversion
    1.10 +//
    1.11 +// Contact the author at: fernando_cacciola@hotmail.com
    1.12 +// 
    1.13 +#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP
    1.14 +#define BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP
    1.15 +
    1.16 +#include "boost/config.hpp"
    1.17 +#include "boost/limits.hpp"
    1.18 +
    1.19 +#include "boost/numeric/conversion/sign_mixture_enum.hpp"
    1.20 +#include "boost/numeric/conversion/detail/meta.hpp"
    1.21 +
    1.22 +#include "boost/mpl/integral_c.hpp"
    1.23 +
    1.24 +namespace boost { namespace numeric { namespace convdetail
    1.25 +{
    1.26 +  // Integral Constants for 'SignMixture'
    1.27 +  typedef mpl::integral_c<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
    1.28 +  typedef mpl::integral_c<sign_mixture_enum, signed_to_signed>     sig2sig_c ;
    1.29 +  typedef mpl::integral_c<sign_mixture_enum, signed_to_unsigned>   sig2unsig_c ;
    1.30 +  typedef mpl::integral_c<sign_mixture_enum, unsigned_to_signed>   unsig2sig_c ;
    1.31 +
    1.32 +  // Metafunction:
    1.33 +  //
    1.34 +  //   get_sign_mixture<T,S>::type
    1.35 +  //
    1.36 +  // Selects the appropriate SignMixture Integral Constant for the combination T,S.
    1.37 +  //
    1.38 +  template<class T,class S>
    1.39 +  struct get_sign_mixture
    1.40 +  {
    1.41 +    typedef mpl::bool_< ::std::numeric_limits<S>::is_signed > S_signed ;
    1.42 +    typedef mpl::bool_< ::std::numeric_limits<T>::is_signed > T_signed ;
    1.43 +
    1.44 +    typedef typename
    1.45 +      for_both<S_signed, T_signed, sig2sig_c, sig2unsig_c, unsig2sig_c, unsig2unsig_c>::type
    1.46 +        type ;
    1.47 +  } ;
    1.48 +
    1.49 +  // Metafunction:
    1.50 +  //
    1.51 +  //   for_sign_mixture<SignMixture,Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig>::type
    1.52 +  //
    1.53 +  // {SignMixture} is one of the Integral Constants for SignMixture, declared above.
    1.54 +  // {Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig} are aribtrary types. (not metafunctions)
    1.55 +  //
    1.56 +  // According to the value of 'SignMixture', selects the corresponding type.
    1.57 +  //
    1.58 +  template<class SignMixture, class Sig2Sig, class Sig2Unsig, class Unsig2Sig, class Unsig2Unsig>
    1.59 +  struct for_sign_mixture
    1.60 +  {
    1.61 +    typedef typename
    1.62 +      ct_switch4<SignMixture
    1.63 +                 , sig2sig_c, sig2unsig_c, unsig2sig_c  // default
    1.64 +                 , Sig2Sig  , Sig2Unsig  , Unsig2Sig  , Unsig2Unsig
    1.65 +                >::type
    1.66 +        type ;
    1.67 +  } ;
    1.68 +
    1.69 +} } } // namespace boost::numeric::convdetail
    1.70 +
    1.71 +#endif
    1.72 +//
    1.73 +///////////////////////////////////////////////////////////////////////////////////////////////
    1.74 +
    1.75 +