BVB Source Codes

mars Show conversion_traits.hpp Source code

Return Download mars: download conversion_traits.hpp Source code - Download mars Source code - Type:.hpp
  1. //  (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
  2. //  Use, modification, and distribution is subject to the Boost Software
  3. //  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. //  http://www.boost.org/LICENSE_1_0.txt)
  5.  
  6. //  See library home page at http://www.boost.org/libs/numeric/conversion
  7. //
  8. // Contact the author at: fernando_cacciola@hotmail.com
  9. //
  10. #ifndef BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
  11. #define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
  12.  
  13. #include "boost/type_traits/is_arithmetic.hpp"
  14. #include "boost/type_traits/is_same.hpp"
  15. #include "boost/type_traits/remove_cv.hpp"
  16.  
  17. #include "boost/numeric/conversion/detail/meta.hpp"
  18. #include "boost/numeric/conversion/detail/int_float_mixture.hpp"
  19. #include "boost/numeric/conversion/detail/sign_mixture.hpp"
  20. #include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp"
  21. #include "boost/numeric/conversion/detail/is_subranged.hpp"
  22.  
  23. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost { namespace numeric { namespace convdetail
  24. {
  25.   //-------------------------------------------------------------------
  26.   // Implementation of the Conversion Traits for T != S
  27.   //
  28.   // This is a VISIBLE base class of the user-level conversion_traits<> class.
  29.   //-------------------------------------------------------------------
  30.   template<class T,class S>
  31.   struct non_trivial_traits_impl
  32.   {
  33.     typedef typename get_int_float_mixture   <T,S>::type int_float_mixture ;
  34.     typedef typename get_sign_mixture        <T,S>::type sign_mixture ;
  35.     typedef typename get_udt_builtin_mixture <T,S>::type udt_builtin_mixture ;
  36.  
  37.     typedef typename get_is_subranged<T,S>::type subranged ;
  38.  
  39.     typedef mpl::false_ trivial ;
  40.  
  41.     typedef T target_type ;
  42.     typedef S source_type ;
  43.     typedef T result_type ;
  44.  
  45.     typedef typename mpl::if_< is_arithmetic<S>, S, S const&>::type argument_type ;
  46.  
  47.     typedef typename mpl::if_<subranged,S,T>::type supertype ;
  48.     typedef typename mpl::if_<subranged,T,S>::type subtype   ;
  49.   } ;
  50.  
  51.   //-------------------------------------------------------------------
  52.   // Implementation of the Conversion Traits for T == S
  53.   //
  54.   // This is a VISIBLE base class of the user-level conversion_traits<> class.
  55.   //-------------------------------------------------------------------
  56.   template<class N>
  57.   struct trivial_traits_impl
  58.   {
  59.     typedef typename get_int_float_mixture  <N,N>::type int_float_mixture ;
  60.     typedef typename get_sign_mixture       <N,N>::type sign_mixture ;
  61.     typedef typename get_udt_builtin_mixture<N,N>::type udt_builtin_mixture ;
  62.  
  63.     typedef mpl::false_ subranged ;
  64.     typedef mpl::true_  trivial ;
  65.  
  66.     typedef N        target_type ;
  67.     typedef N        source_type ;
  68.     typedef N const& result_type ;
  69.     typedef N const& argument_type ;
  70.  
  71.     typedef N supertype ;
  72.     typedef N subtype  ;
  73.  
  74.   } ;
  75.  
  76.   //-------------------------------------------------------------------
  77.   // Top level implementation selector.
  78.   //-------------------------------------------------------------------
  79.   template<class T, class S>
  80.   struct get_conversion_traits
  81.   {
  82.     typedef typename remove_cv<T>::type target_type ;
  83.     typedef typename remove_cv<S>::type source_type ;
  84.  
  85.     typedef typename is_same<target_type,source_type>::type is_trivial ;
  86.  
  87.     typedef trivial_traits_impl    <target_type>             trivial_imp ;
  88.     typedef non_trivial_traits_impl<target_type,source_type> non_trivial_imp ;
  89.  
  90.     typedef typename mpl::if_<is_trivial,trivial_imp,non_trivial_imp>::type type ;
  91.   } ;
  92.  
  93. } } } // namespace mars_boost::numeric::convdetail
  94.  
  95. #endif
  96.  
  97.  
  98.  
downloadconversion_traits.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top