Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:46

0001 //  (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
0002 //  Use, modification, and distribution is subject to the Boost Software
0003 //  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0004 //  http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 //  See library home page at http://www.boost.org/libs/numeric/conversion
0007 //
0008 // Contact the author at: fernando_cacciola@hotmail.com
0009 // 
0010 #ifndef BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP
0011 #define BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP
0012 
0013 #include "boost/limits.hpp"
0014 #include "boost/config.hpp"
0015 #include "boost/mpl/if.hpp"
0016 
0017 namespace boost { namespace numeric { namespace boundsdetail
0018 {
0019   template<class N>
0020   class Integral
0021   {
0022       typedef std::numeric_limits<N> limits ;
0023 
0024     public :
0025     
0026       static N lowest  () { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
0027       static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
0028       static N smallest() { return static_cast<N>(1); }
0029   } ;
0030 
0031   template<class N>
0032   class Float
0033   {
0034       typedef std::numeric_limits<N> limits ;
0035 
0036     public :
0037     
0038       static N lowest  () { return static_cast<N>(-limits::max BOOST_PREVENT_MACRO_SUBSTITUTION ()) ; }
0039       static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
0040       static N smallest() { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
0041   } ;
0042 
0043   template<class N>
0044   struct get_impl
0045   {
0046     typedef mpl::bool_< ::std::numeric_limits<N>::is_integer > is_int ;
0047 
0048     typedef Integral<N> impl_int   ;
0049     typedef Float   <N> impl_float ;
0050 
0051     typedef typename mpl::if_<is_int,impl_int,impl_float>::type type ;
0052   } ;
0053 
0054 } } } // namespace boost::numeric::boundsdetail.
0055 
0056 #endif
0057 //
0058 ///////////////////////////////////////////////////////////////////////////////////////////////