12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #ifndef BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP
- #define BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP
- #include <boost/detail/workaround.hpp>
- #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x582))
- # include<boost/numeric/conversion/detail/old_numeric_cast.hpp>
- #else
- #include <boost/type.hpp>
- #include <boost/numeric/conversion/converter.hpp>
- #include <boost/numeric/conversion/numeric_cast_traits.hpp>
- namespace boost
- {
- template <typename Target, typename Source>
- inline Target numeric_cast( Source arg )
- {
- typedef numeric::conversion_traits<Target, Source> conv_traits;
- typedef numeric::numeric_cast_traits<Target, Source> cast_traits;
- typedef boost::numeric::converter
- <
- Target,
- Source,
- conv_traits,
- typename cast_traits::overflow_policy,
- typename cast_traits::rounding_policy,
- boost::numeric::raw_converter< conv_traits >,
- typename cast_traits::range_checking_policy
- > converter;
- return converter::convert(arg);
- }
-
- using numeric::bad_numeric_cast;
- }
- #endif
- #endif
|