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_BOUNDS_DETAIL_FLC_12NOV2002_HPP
|
Chris@16
|
11 #define BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP
|
Chris@16
|
12
|
Chris@16
|
13 #include "boost/limits.hpp"
|
Chris@16
|
14 #include "boost/config.hpp"
|
Chris@16
|
15 #include "boost/mpl/if.hpp"
|
Chris@16
|
16
|
Chris@16
|
17 namespace boost { namespace numeric { namespace boundsdetail
|
Chris@16
|
18 {
|
Chris@16
|
19 template<class N>
|
Chris@16
|
20 class Integral
|
Chris@16
|
21 {
|
Chris@16
|
22 typedef std::numeric_limits<N> limits ;
|
Chris@16
|
23
|
Chris@16
|
24 public :
|
Chris@16
|
25
|
Chris@16
|
26 static N lowest () { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
|
Chris@16
|
27 static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
|
Chris@16
|
28 static N smallest() { return static_cast<N>(1); }
|
Chris@16
|
29 } ;
|
Chris@16
|
30
|
Chris@16
|
31 template<class N>
|
Chris@16
|
32 class Float
|
Chris@16
|
33 {
|
Chris@16
|
34 typedef std::numeric_limits<N> limits ;
|
Chris@16
|
35
|
Chris@16
|
36 public :
|
Chris@16
|
37
|
Chris@16
|
38 static N lowest () { return static_cast<N>(-limits::max BOOST_PREVENT_MACRO_SUBSTITUTION ()) ; }
|
Chris@16
|
39 static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
|
Chris@16
|
40 static N smallest() { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
|
Chris@16
|
41 } ;
|
Chris@16
|
42
|
Chris@16
|
43 template<class N>
|
Chris@16
|
44 struct get_impl
|
Chris@16
|
45 {
|
Chris@16
|
46 typedef mpl::bool_< ::std::numeric_limits<N>::is_integer > is_int ;
|
Chris@16
|
47
|
Chris@16
|
48 typedef Integral<N> impl_int ;
|
Chris@16
|
49 typedef Float <N> impl_float ;
|
Chris@16
|
50
|
Chris@16
|
51 typedef typename mpl::if_<is_int,impl_int,impl_float>::type type ;
|
Chris@16
|
52 } ;
|
Chris@16
|
53
|
Chris@16
|
54 } } } // namespace boost::numeric::boundsdetail.
|
Chris@16
|
55
|
Chris@16
|
56 #endif
|
Chris@16
|
57 //
|
Chris@16
|
58 ///////////////////////////////////////////////////////////////////////////////////////////////
|