diff options
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 | 
 Swift
 Swift