File indexing completed on 2025-01-18 09:42:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
0011 #define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
0012
0013 #include "boost/type_traits/is_arithmetic.hpp"
0014 #include "boost/type_traits/is_same.hpp"
0015 #include "boost/type_traits/remove_cv.hpp"
0016
0017 #include "boost/numeric/conversion/detail/meta.hpp"
0018 #include "boost/numeric/conversion/detail/int_float_mixture.hpp"
0019 #include "boost/numeric/conversion/detail/sign_mixture.hpp"
0020 #include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp"
0021 #include "boost/numeric/conversion/detail/is_subranged.hpp"
0022
0023 namespace boost { namespace numeric { namespace convdetail
0024 {
0025
0026
0027
0028
0029
0030 template<class T,class S>
0031 struct non_trivial_traits_impl
0032 {
0033 typedef typename get_int_float_mixture <T,S>::type int_float_mixture ;
0034 typedef typename get_sign_mixture <T,S>::type sign_mixture ;
0035 typedef typename get_udt_builtin_mixture <T,S>::type udt_builtin_mixture ;
0036
0037 typedef typename get_is_subranged<T,S>::type subranged ;
0038
0039 typedef mpl::false_ trivial ;
0040
0041 typedef T target_type ;
0042 typedef S source_type ;
0043 typedef T result_type ;
0044
0045 typedef typename mpl::if_< is_arithmetic<S>, S, S const&>::type argument_type ;
0046
0047 typedef typename mpl::if_<subranged,S,T>::type supertype ;
0048 typedef typename mpl::if_<subranged,T,S>::type subtype ;
0049 } ;
0050
0051
0052
0053
0054
0055
0056 template<class N>
0057 struct trivial_traits_impl
0058 {
0059 typedef typename get_int_float_mixture <N,N>::type int_float_mixture ;
0060 typedef typename get_sign_mixture <N,N>::type sign_mixture ;
0061 typedef typename get_udt_builtin_mixture<N,N>::type udt_builtin_mixture ;
0062
0063 typedef mpl::false_ subranged ;
0064 typedef mpl::true_ trivial ;
0065
0066 typedef N target_type ;
0067 typedef N source_type ;
0068 typedef N const& result_type ;
0069 typedef N const& argument_type ;
0070
0071 typedef N supertype ;
0072 typedef N subtype ;
0073
0074 } ;
0075
0076
0077
0078
0079 template<class T, class S>
0080 struct get_conversion_traits
0081 {
0082 typedef typename remove_cv<T>::type target_type ;
0083 typedef typename remove_cv<S>::type source_type ;
0084
0085 typedef typename is_same<target_type,source_type>::type is_trivial ;
0086
0087 typedef trivial_traits_impl <target_type> trivial_imp ;
0088 typedef non_trivial_traits_impl<target_type,source_type> non_trivial_imp ;
0089
0090 typedef typename mpl::if_<is_trivial,trivial_imp,non_trivial_imp>::type type ;
0091 } ;
0092
0093 } } }
0094
0095 #endif
0096
0097