os/ossrv/ossrv_pub/boost_apis/boost/numeric/conversion/converter.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
//  © Copyright Fernando Luis Cacciola Carballal 2000-2004
sl@0
     2
//  Use, modification, and distribution is subject to the Boost Software
sl@0
     3
//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
sl@0
     4
//  http://www.boost.org/LICENSE_1_0.txt)
sl@0
     5
sl@0
     6
//  See library home page at http://www.boost.org/libs/numeric/conversion
sl@0
     7
//
sl@0
     8
// Contact the author at: fernando_cacciola@hotmail.com
sl@0
     9
// 
sl@0
    10
#ifndef BOOST_NUMERIC_CONVERSION_CONVERTER_FLC_12NOV2002_HPP
sl@0
    11
#define BOOST_NUMERIC_CONVERSION_CONVERTER_FLC_12NOV2002_HPP
sl@0
    12
sl@0
    13
#include "boost/numeric/conversion/conversion_traits.hpp"
sl@0
    14
#include "boost/numeric/conversion/converter_policies.hpp"
sl@0
    15
sl@0
    16
#include "boost/numeric/conversion/detail/converter.hpp"
sl@0
    17
sl@0
    18
namespace boost { namespace numeric 
sl@0
    19
{
sl@0
    20
sl@0
    21
template<class T,
sl@0
    22
         class S,
sl@0
    23
         class Traits           = conversion_traits<T,S>,
sl@0
    24
         class OverflowHandler  = def_overflow_handler,
sl@0
    25
         class Float2IntRounder = Trunc< BOOST_DEDUCED_TYPENAME Traits::source_type>  ,
sl@0
    26
         class RawConverter     = raw_converter<Traits>,
sl@0
    27
         class UserRangeChecker = UseInternalRangeChecker
sl@0
    28
        >
sl@0
    29
struct converter : convdetail::get_converter_impl<Traits,
sl@0
    30
                                                  OverflowHandler,
sl@0
    31
                                                  Float2IntRounder,
sl@0
    32
                                                  RawConverter,
sl@0
    33
                                                  UserRangeChecker
sl@0
    34
                                                 >::type
sl@0
    35
{
sl@0
    36
  typedef Traits traits ;
sl@0
    37
sl@0
    38
  typedef typename Traits::argument_type argument_type ;
sl@0
    39
  typedef typename Traits::result_type   result_type   ;
sl@0
    40
sl@0
    41
  result_type operator() ( argument_type s ) const { return this->convert(s) ; }
sl@0
    42
} ;
sl@0
    43
sl@0
    44
sl@0
    45
sl@0
    46
template<class S,
sl@0
    47
         class OverflowHandler  = def_overflow_handler,
sl@0
    48
         class Float2IntRounder = Trunc<S>  ,
sl@0
    49
         class UserRangeChecker = UseInternalRangeChecker
sl@0
    50
        >
sl@0
    51
struct make_converter_from
sl@0
    52
{
sl@0
    53
  template<class T,
sl@0
    54
           class Traits       = conversion_traits<T,S>,
sl@0
    55
           class RawConverter = raw_converter<Traits>
sl@0
    56
          > 
sl@0
    57
  struct to
sl@0
    58
  {
sl@0
    59
    typedef converter<T,S,Traits,OverflowHandler,Float2IntRounder,RawConverter,UserRangeChecker> type ;
sl@0
    60
  } ;
sl@0
    61
sl@0
    62
} ;
sl@0
    63
sl@0
    64
} } // namespace boost::numeric
sl@0
    65
sl@0
    66
#endif
sl@0
    67
sl@0
    68