1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/numeric/conversion/detail/conversion_traits.hpp Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,97 @@
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_CONVERSION_TRAITS_FLC_12NOV2002_HPP
1.14 +#define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
1.15 +
1.16 +#include "boost/type_traits/is_arithmetic.hpp"
1.17 +#include "boost/type_traits/is_same.hpp"
1.18 +#include "boost/type_traits/remove_cv.hpp"
1.19 +
1.20 +#include "boost/numeric/conversion/detail/meta.hpp"
1.21 +#include "boost/numeric/conversion/detail/int_float_mixture.hpp"
1.22 +#include "boost/numeric/conversion/detail/sign_mixture.hpp"
1.23 +#include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp"
1.24 +#include "boost/numeric/conversion/detail/is_subranged.hpp"
1.25 +
1.26 +namespace boost { namespace numeric { namespace convdetail
1.27 +{
1.28 + //-------------------------------------------------------------------
1.29 + // Implementation of the Conversion Traits for T != S
1.30 + //
1.31 + // This is a VISIBLE base class of the user-level conversion_traits<> class.
1.32 + //-------------------------------------------------------------------
1.33 + template<class T,class S>
1.34 + struct non_trivial_traits_impl
1.35 + {
1.36 + typedef typename get_int_float_mixture <T,S>::type int_float_mixture ;
1.37 + typedef typename get_sign_mixture <T,S>::type sign_mixture ;
1.38 + typedef typename get_udt_builtin_mixture <T,S>::type udt_builtin_mixture ;
1.39 +
1.40 + typedef typename get_is_subranged<T,S>::type subranged ;
1.41 +
1.42 + typedef mpl::false_ trivial ;
1.43 +
1.44 + typedef T target_type ;
1.45 + typedef S source_type ;
1.46 + typedef T result_type ;
1.47 +
1.48 + typedef typename mpl::if_< is_arithmetic<S>, S, S const&>::type argument_type ;
1.49 +
1.50 + typedef typename mpl::if_<subranged,S,T>::type supertype ;
1.51 + typedef typename mpl::if_<subranged,T,S>::type subtype ;
1.52 + } ;
1.53 +
1.54 + //-------------------------------------------------------------------
1.55 + // Implementation of the Conversion Traits for T == S
1.56 + //
1.57 + // This is a VISIBLE base class of the user-level conversion_traits<> class.
1.58 + //-------------------------------------------------------------------
1.59 + template<class N>
1.60 + struct trivial_traits_impl
1.61 + {
1.62 + typedef typename get_int_float_mixture <N,N>::type int_float_mixture ;
1.63 + typedef typename get_sign_mixture <N,N>::type sign_mixture ;
1.64 + typedef typename get_udt_builtin_mixture<N,N>::type udt_builtin_mixture ;
1.65 +
1.66 + typedef mpl::false_ subranged ;
1.67 + typedef mpl::true_ trivial ;
1.68 +
1.69 + typedef N target_type ;
1.70 + typedef N source_type ;
1.71 + typedef N const& result_type ;
1.72 + typedef N const& argument_type ;
1.73 +
1.74 + typedef N supertype ;
1.75 + typedef N subtype ;
1.76 +
1.77 + } ;
1.78 +
1.79 + //-------------------------------------------------------------------
1.80 + // Top level implementation selector.
1.81 + //-------------------------------------------------------------------
1.82 + template<class T, class S>
1.83 + struct get_conversion_traits
1.84 + {
1.85 + typedef typename remove_cv<T>::type target_type ;
1.86 + typedef typename remove_cv<S>::type source_type ;
1.87 +
1.88 + typedef typename is_same<target_type,source_type>::type is_trivial ;
1.89 +
1.90 + typedef trivial_traits_impl <target_type> trivial_imp ;
1.91 + typedef non_trivial_traits_impl<target_type,source_type> non_trivial_imp ;
1.92 +
1.93 + typedef typename mpl::if_<is_trivial,trivial_imp,non_trivial_imp>::type type ;
1.94 + } ;
1.95 +
1.96 +} } } // namespace boost::numeric::convdetail
1.97 +
1.98 +#endif
1.99 +
1.100 +