os/ossrv/ossrv_pub/boost_apis/boost/numeric/conversion/cast.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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
//
sl@0
    11
//  Revision History
sl@0
    12
//
sl@0
    13
//    19 Nov 2001 Syntatic changes as suggested by Darin Adler (Fernando Cacciola)
sl@0
    14
//    08 Nov 2001 Fixes to accommodate MSVC (Fernando Cacciola)
sl@0
    15
//    04 Nov 2001 Fixes to accommodate gcc2.92 (Fernando Cacciola)
sl@0
    16
//    30 Oct 2001 Some fixes suggested by Daryle Walker (Fernando Cacciola)
sl@0
    17
//    25 Oct 2001 Initial boostification (Fernando Cacciola)
sl@0
    18
//    23 Jan 2004 Inital add to cvs (post review)s
sl@0
    19
//
sl@0
    20
#ifndef BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP
sl@0
    21
#define BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP
sl@0
    22
sl@0
    23
#include <boost/detail/workaround.hpp>
sl@0
    24
sl@0
    25
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
sl@0
    26
sl@0
    27
#  include<boost/numeric/conversion/detail/old_numeric_cast.hpp>
sl@0
    28
sl@0
    29
#else
sl@0
    30
sl@0
    31
#include <boost/type.hpp>
sl@0
    32
#include <boost/numeric/conversion/converter.hpp>
sl@0
    33
sl@0
    34
namespace boost
sl@0
    35
{
sl@0
    36
  template<typename Target, typename Source>
sl@0
    37
  inline
sl@0
    38
  Target numeric_cast ( Source arg )
sl@0
    39
  {
sl@0
    40
    typedef boost::numeric::converter<Target,Source> Converter ;
sl@0
    41
    return Converter::convert(arg);
sl@0
    42
  }
sl@0
    43
sl@0
    44
  using numeric::bad_numeric_cast;
sl@0
    45
sl@0
    46
} // namespace boost
sl@0
    47
sl@0
    48
#endif
sl@0
    49
sl@0
    50
sl@0
    51
#endif