epoc32/include/stdapis/boost/numeric/conversion/detail/bounds.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100 (2010-03-31)
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
//  © Copyright Fernando Luis Cacciola Carballal 2000-2004
williamr@2
     2
//  Use, modification, and distribution is subject to the Boost Software
williamr@2
     3
//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
williamr@2
     4
//  http://www.boost.org/LICENSE_1_0.txt)
williamr@2
     5
williamr@2
     6
//  See library home page at http://www.boost.org/libs/numeric/conversion
williamr@2
     7
//
williamr@2
     8
// Contact the author at: fernando_cacciola@hotmail.com
williamr@2
     9
// 
williamr@2
    10
#ifndef BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP
williamr@2
    11
#define BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP
williamr@2
    12
williamr@2
    13
#include "boost/limits.hpp"
williamr@2
    14
#include "boost/config.hpp"
williamr@2
    15
#include "boost/mpl/if.hpp"
williamr@2
    16
williamr@2
    17
namespace boost { namespace numeric { namespace boundsdetail
williamr@2
    18
{
williamr@2
    19
  template<class N>
williamr@2
    20
  class Integral
williamr@2
    21
  {
williamr@2
    22
      typedef std::numeric_limits<N> limits ;
williamr@2
    23
williamr@2
    24
    public :
williamr@2
    25
    
williamr@2
    26
      static N lowest  () { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
williamr@2
    27
      static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
williamr@2
    28
      static N smallest() { return static_cast<N>(1); }
williamr@2
    29
  } ;
williamr@2
    30
williamr@2
    31
  template<class N>
williamr@2
    32
  class Float
williamr@2
    33
  {
williamr@2
    34
      typedef std::numeric_limits<N> limits ;
williamr@2
    35
williamr@2
    36
    public :
williamr@2
    37
    
williamr@2
    38
      static N lowest  () { return static_cast<N>(-limits::max BOOST_PREVENT_MACRO_SUBSTITUTION ()) ; }
williamr@2
    39
      static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
williamr@2
    40
      static N smallest() { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
williamr@2
    41
  } ;
williamr@2
    42
williamr@2
    43
  template<class N>
williamr@2
    44
  struct get_impl
williamr@2
    45
  {
williamr@2
    46
    typedef mpl::bool_< ::std::numeric_limits<N>::is_integer > is_int ;
williamr@2
    47
williamr@2
    48
    typedef Integral<N> impl_int   ;
williamr@2
    49
    typedef Float   <N> impl_float ;
williamr@2
    50
williamr@2
    51
    typedef typename mpl::if_<is_int,impl_int,impl_float>::type type ;
williamr@2
    52
  } ;
williamr@2
    53
williamr@2
    54
} } } // namespace boost::numeric::boundsdetail.
williamr@2
    55
williamr@2
    56
#endif
williamr@2
    57
//
williamr@2
    58
///////////////////////////////////////////////////////////////////////////////////////////////