annotate DEPENDENCIES/generic/include/boost/numeric/conversion/detail/conversion_traits.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
Chris@16 2 // Use, modification, and distribution is subject to the Boost Software
Chris@16 3 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5
Chris@16 6 // See library home page at http://www.boost.org/libs/numeric/conversion
Chris@16 7 //
Chris@16 8 // Contact the author at: fernando_cacciola@hotmail.com
Chris@16 9 //
Chris@16 10 #ifndef BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
Chris@16 11 #define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
Chris@16 12
Chris@16 13 #include "boost/type_traits/is_arithmetic.hpp"
Chris@16 14 #include "boost/type_traits/is_same.hpp"
Chris@16 15 #include "boost/type_traits/remove_cv.hpp"
Chris@16 16
Chris@16 17 #include "boost/numeric/conversion/detail/meta.hpp"
Chris@16 18 #include "boost/numeric/conversion/detail/int_float_mixture.hpp"
Chris@16 19 #include "boost/numeric/conversion/detail/sign_mixture.hpp"
Chris@16 20 #include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp"
Chris@16 21 #include "boost/numeric/conversion/detail/is_subranged.hpp"
Chris@16 22
Chris@16 23 namespace boost { namespace numeric { namespace convdetail
Chris@16 24 {
Chris@16 25 //-------------------------------------------------------------------
Chris@16 26 // Implementation of the Conversion Traits for T != S
Chris@16 27 //
Chris@16 28 // This is a VISIBLE base class of the user-level conversion_traits<> class.
Chris@16 29 //-------------------------------------------------------------------
Chris@16 30 template<class T,class S>
Chris@16 31 struct non_trivial_traits_impl
Chris@16 32 {
Chris@16 33 typedef typename get_int_float_mixture <T,S>::type int_float_mixture ;
Chris@16 34 typedef typename get_sign_mixture <T,S>::type sign_mixture ;
Chris@16 35 typedef typename get_udt_builtin_mixture <T,S>::type udt_builtin_mixture ;
Chris@16 36
Chris@16 37 typedef typename get_is_subranged<T,S>::type subranged ;
Chris@16 38
Chris@16 39 typedef mpl::false_ trivial ;
Chris@16 40
Chris@16 41 typedef T target_type ;
Chris@16 42 typedef S source_type ;
Chris@16 43 typedef T result_type ;
Chris@16 44
Chris@16 45 typedef typename mpl::if_< is_arithmetic<S>, S, S const&>::type argument_type ;
Chris@16 46
Chris@16 47 typedef typename mpl::if_<subranged,S,T>::type supertype ;
Chris@16 48 typedef typename mpl::if_<subranged,T,S>::type subtype ;
Chris@16 49 } ;
Chris@16 50
Chris@16 51 //-------------------------------------------------------------------
Chris@16 52 // Implementation of the Conversion Traits for T == S
Chris@16 53 //
Chris@16 54 // This is a VISIBLE base class of the user-level conversion_traits<> class.
Chris@16 55 //-------------------------------------------------------------------
Chris@16 56 template<class N>
Chris@16 57 struct trivial_traits_impl
Chris@16 58 {
Chris@16 59 typedef typename get_int_float_mixture <N,N>::type int_float_mixture ;
Chris@16 60 typedef typename get_sign_mixture <N,N>::type sign_mixture ;
Chris@16 61 typedef typename get_udt_builtin_mixture<N,N>::type udt_builtin_mixture ;
Chris@16 62
Chris@16 63 typedef mpl::false_ subranged ;
Chris@16 64 typedef mpl::true_ trivial ;
Chris@16 65
Chris@16 66 typedef N target_type ;
Chris@16 67 typedef N source_type ;
Chris@16 68 typedef N const& result_type ;
Chris@16 69 typedef N const& argument_type ;
Chris@16 70
Chris@16 71 typedef N supertype ;
Chris@16 72 typedef N subtype ;
Chris@16 73
Chris@16 74 } ;
Chris@16 75
Chris@16 76 //-------------------------------------------------------------------
Chris@16 77 // Top level implementation selector.
Chris@16 78 //-------------------------------------------------------------------
Chris@16 79 template<class T, class S>
Chris@16 80 struct get_conversion_traits
Chris@16 81 {
Chris@16 82 typedef typename remove_cv<T>::type target_type ;
Chris@16 83 typedef typename remove_cv<S>::type source_type ;
Chris@16 84
Chris@16 85 typedef typename is_same<target_type,source_type>::type is_trivial ;
Chris@16 86
Chris@16 87 typedef trivial_traits_impl <target_type> trivial_imp ;
Chris@16 88 typedef non_trivial_traits_impl<target_type,source_type> non_trivial_imp ;
Chris@16 89
Chris@16 90 typedef typename mpl::if_<is_trivial,trivial_imp,non_trivial_imp>::type type ;
Chris@16 91 } ;
Chris@16 92
Chris@16 93 } } } // namespace boost::numeric::convdetail
Chris@16 94
Chris@16 95 #endif
Chris@16 96
Chris@16 97