Blame view

3rdparty/boost_1_81_0/boost/numeric/conversion/converter.hpp 2.19 KB
63e88f80   Hu Chunming   提交三方库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  //  (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
  //  Use, modification, and distribution is subject to the Boost Software
  //  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  //  http://www.boost.org/LICENSE_1_0.txt)
  
  //  See library home page at http://www.boost.org/libs/numeric/conversion
  //
  // Contact the author at: fernando_cacciola@hotmail.com
  // 
  #ifndef BOOST_NUMERIC_CONVERSION_CONVERTER_FLC_12NOV2002_HPP
  #define BOOST_NUMERIC_CONVERSION_CONVERTER_FLC_12NOV2002_HPP
  
  #include "boost/numeric/conversion/conversion_traits.hpp"
  #include "boost/numeric/conversion/converter_policies.hpp"
  
  #include "boost/numeric/conversion/detail/converter.hpp"
  
  namespace boost { namespace numeric 
  {
  
  template<class T,
           class S,
           class Traits           = conversion_traits<T,S>,
           class OverflowHandler  = def_overflow_handler,
           class Float2IntRounder = Trunc< BOOST_DEDUCED_TYPENAME Traits::source_type>  ,
           class RawConverter     = raw_converter<Traits>,
           class UserRangeChecker = UseInternalRangeChecker
          >
  struct converter : convdetail::get_converter_impl<Traits,
                                                    OverflowHandler,
                                                    Float2IntRounder,
                                                    RawConverter,
                                                    UserRangeChecker
                                                   >::type
  {
    typedef Traits traits ;
  
    typedef typename Traits::argument_type argument_type ;
    typedef typename Traits::result_type   result_type   ;
  
    result_type result_type operator() ( argument_type s ) const { return this->convert(s) ;() ( argument_type s ) const { return this->convert(s) result_type operator() ( argument_type s ) const { return this->convert(s) ; }
  } ;
  
  
  
  template<class S,
           class OverflowHandler  = def_overflow_handler,
           class Float2IntRounder = Trunc<S>  ,
           class UserRangeChecker = UseInternalRangeChecker
          >
  struct make_converter_from
  {
    template<class T,
             class Traits       = conversion_traits<T,S>,
             class RawConverter = raw_converter<Traits>
            > 
    struct to
    {
      typedef converter<T,S,Traits,OverflowHandler,Float2IntRounder,RawConverter,UserRangeChecker> type ;
    } ;
  
  } ;
  
  } } // namespace boost::numeric
  
  #endif