diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-12-23 13:16:26 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-12-23 14:43:26 (GMT) |
commit | 491ddd570a752cf9bda85933bed0c6942e39b1f9 (patch) | |
tree | 10c25c1be8cc08d0497df1dccd56a10fbb30beee /3rdParty/Boost/src/boost/numeric/conversion/cast.hpp | |
parent | da7d7a0ca71b80281aa9ff2526290b61ccb0cc60 (diff) | |
download | swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.zip swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.tar.bz2 |
Update Boost to 1.52.0.
Change-Id: I1e56bea2600bf2ed9c5b3aba8c4f9d2a0f350e77
Diffstat (limited to '3rdParty/Boost/src/boost/numeric/conversion/cast.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/numeric/conversion/cast.hpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/3rdParty/Boost/src/boost/numeric/conversion/cast.hpp b/3rdParty/Boost/src/boost/numeric/conversion/cast.hpp index aa518e8..1ee0251 100644 --- a/3rdParty/Boost/src/boost/numeric/conversion/cast.hpp +++ b/3rdParty/Boost/src/boost/numeric/conversion/cast.hpp @@ -16,6 +16,7 @@ // 30 Oct 2001 Some fixes suggested by Daryle Walker (Fernando Cacciola) // 25 Oct 2001 Initial boostification (Fernando Cacciola) // 23 Jan 2004 Inital add to cvs (post review)s +// 22 Jun 2011 Added support for specializing cast policies via numeric_cast_traits (Brandon Kohn). // #ifndef BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP #define BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP @@ -30,22 +31,31 @@ #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 boost::numeric::converter<Target,Source> Converter ; - return Converter::convert(arg); - } - - using numeric::bad_numeric_cast; - + 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; } // namespace boost #endif - #endif |