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_CONVERTER_FLC_12NOV2002_HPP
|
Chris@16
|
11 #define BOOST_NUMERIC_CONVERSION_CONVERTER_FLC_12NOV2002_HPP
|
Chris@16
|
12
|
Chris@16
|
13 #include "boost/numeric/conversion/conversion_traits.hpp"
|
Chris@16
|
14 #include "boost/numeric/conversion/converter_policies.hpp"
|
Chris@16
|
15
|
Chris@16
|
16 #include "boost/numeric/conversion/detail/converter.hpp"
|
Chris@16
|
17
|
Chris@16
|
18 namespace boost { namespace numeric
|
Chris@16
|
19 {
|
Chris@16
|
20
|
Chris@16
|
21 template<class T,
|
Chris@16
|
22 class S,
|
Chris@16
|
23 class Traits = conversion_traits<T,S>,
|
Chris@16
|
24 class OverflowHandler = def_overflow_handler,
|
Chris@16
|
25 class Float2IntRounder = Trunc< BOOST_DEDUCED_TYPENAME Traits::source_type> ,
|
Chris@16
|
26 class RawConverter = raw_converter<Traits>,
|
Chris@16
|
27 class UserRangeChecker = UseInternalRangeChecker
|
Chris@16
|
28 >
|
Chris@16
|
29 struct converter : convdetail::get_converter_impl<Traits,
|
Chris@16
|
30 OverflowHandler,
|
Chris@16
|
31 Float2IntRounder,
|
Chris@16
|
32 RawConverter,
|
Chris@16
|
33 UserRangeChecker
|
Chris@16
|
34 >::type
|
Chris@16
|
35 {
|
Chris@16
|
36 typedef Traits traits ;
|
Chris@16
|
37
|
Chris@16
|
38 typedef typename Traits::argument_type argument_type ;
|
Chris@16
|
39 typedef typename Traits::result_type result_type ;
|
Chris@16
|
40
|
Chris@16
|
41 result_type operator() ( argument_type s ) const { return this->convert(s) ; }
|
Chris@16
|
42 } ;
|
Chris@16
|
43
|
Chris@16
|
44
|
Chris@16
|
45
|
Chris@16
|
46 template<class S,
|
Chris@16
|
47 class OverflowHandler = def_overflow_handler,
|
Chris@16
|
48 class Float2IntRounder = Trunc<S> ,
|
Chris@16
|
49 class UserRangeChecker = UseInternalRangeChecker
|
Chris@16
|
50 >
|
Chris@16
|
51 struct make_converter_from
|
Chris@16
|
52 {
|
Chris@16
|
53 template<class T,
|
Chris@16
|
54 class Traits = conversion_traits<T,S>,
|
Chris@16
|
55 class RawConverter = raw_converter<Traits>
|
Chris@16
|
56 >
|
Chris@16
|
57 struct to
|
Chris@16
|
58 {
|
Chris@16
|
59 typedef converter<T,S,Traits,OverflowHandler,Float2IntRounder,RawConverter,UserRangeChecker> type ;
|
Chris@16
|
60 } ;
|
Chris@16
|
61
|
Chris@16
|
62 } ;
|
Chris@16
|
63
|
Chris@16
|
64 } } // namespace boost::numeric
|
Chris@16
|
65
|
Chris@16
|
66 #endif
|
Chris@16
|
67
|
Chris@16
|
68
|