1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/numeric/conversion/detail/udt_builtin_mixture.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,69 @@
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_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
1.14 +#define BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
1.15 +
1.16 +#include "boost/type_traits/is_arithmetic.hpp"
1.17 +
1.18 +#include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp"
1.19 +#include "boost/numeric/conversion/detail/meta.hpp"
1.20 +
1.21 +#include "boost/mpl/integral_c.hpp"
1.22 +
1.23 +namespace boost { namespace numeric { namespace convdetail
1.24 +{
1.25 + // Integral Constants for 'UdtMixture'
1.26 + typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
1.27 + typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_udt> builtin2udt_c ;
1.28 + typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_builtin> udt2builtin_c ;
1.29 + typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_udt> udt2udt_c ;
1.30 +
1.31 + // Metafunction:
1.32 + //
1.33 + // for_udt_mixture<UdtMixture,BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt>::type
1.34 + //
1.35 + // {UdtMixture} is one of the Integral Constants for UdMixture, declared above.
1.36 + // {BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt} are aribtrary types. (not metafunctions)
1.37 + //
1.38 + // According to the value of 'UdtMixture', selects the corresponding type.
1.39 + //
1.40 + template<class UdtMixture, class BuiltIn2BuiltIn, class BuiltIn2Udt, class Udt2BuiltIn, class Udt2Udt>
1.41 + struct for_udt_builtin_mixture
1.42 + {
1.43 + typedef typename
1.44 + ct_switch4<UdtMixture
1.45 + , builtin2builtin_c, builtin2udt_c, udt2builtin_c // default
1.46 + , BuiltIn2BuiltIn , BuiltIn2Udt , Udt2BuiltIn , Udt2Udt
1.47 + >::type
1.48 + type ;
1.49 + } ;
1.50 +
1.51 + // Metafunction:
1.52 + //
1.53 + // get_udt_mixture<T,S>::type
1.54 + //
1.55 + // Selects the appropriate UdtMixture Integral Constant for the combination T,S.
1.56 + //
1.57 + template<class T,class S>
1.58 + struct get_udt_builtin_mixture
1.59 + {
1.60 + typedef is_arithmetic<S> S_builtin ;
1.61 + typedef is_arithmetic<T> T_builtin ;
1.62 +
1.63 + typedef typename
1.64 + for_both<S_builtin, T_builtin, builtin2builtin_c, builtin2udt_c, udt2builtin_c, udt2udt_c>::type
1.65 + type ;
1.66 + } ;
1.67 +
1.68 +} } } // namespace boost::numeric::convdetail
1.69 +
1.70 +#endif
1.71 +
1.72 +