Chris@16: // (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 Chris@16: // Use, modification, and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See library home page at http://www.boost.org/libs/numeric/conversion Chris@16: // Chris@16: // Contact the author at: fernando_cacciola@hotmail.com Chris@16: // Chris@16: #ifndef BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP Chris@16: #define BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP Chris@16: Chris@16: #include "boost/limits.hpp" Chris@16: #include "boost/config.hpp" Chris@16: #include "boost/mpl/if.hpp" Chris@16: Chris@16: namespace boost { namespace numeric { namespace boundsdetail Chris@16: { Chris@16: template Chris@16: class Integral Chris@16: { Chris@16: typedef std::numeric_limits limits ; Chris@16: Chris@16: public : Chris@16: Chris@16: static N lowest () { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); } Chris@16: static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); } Chris@16: static N smallest() { return static_cast(1); } Chris@16: } ; Chris@16: Chris@16: template Chris@16: class Float Chris@16: { Chris@16: typedef std::numeric_limits limits ; Chris@16: Chris@16: public : Chris@16: Chris@16: static N lowest () { return static_cast(-limits::max BOOST_PREVENT_MACRO_SUBSTITUTION ()) ; } Chris@16: static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); } Chris@16: static N smallest() { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); } Chris@16: } ; Chris@16: Chris@16: template Chris@16: struct get_impl Chris@16: { Chris@16: typedef mpl::bool_< ::std::numeric_limits::is_integer > is_int ; Chris@16: Chris@16: typedef Integral impl_int ; Chris@16: typedef Float impl_float ; Chris@16: Chris@16: typedef typename mpl::if_::type type ; Chris@16: } ; Chris@16: Chris@16: } } } // namespace boost::numeric::boundsdetail. Chris@16: Chris@16: #endif Chris@16: // Chris@16: ///////////////////////////////////////////////////////////////////////////////////////////////