12 #include <boost/numeric/conversion/converter.hpp>
49 template<
typename Dst,
typename Src>
52 return boost::numeric::converter<Dst, Src>::convert(v);
82 template<
typename Dst,
typename Src>
85 using Converter = boost::numeric::converter<Dst, Src>;
87 switch (Converter::out_of_range(v))
89 case boost::numeric::cNegOverflow:
return std::numeric_limits<Dst>::min();
90 case boost::numeric::cPosOverflow:
return std::numeric_limits<Dst>::max();
91 case boost::numeric::cInRange:
return Converter::convert(v);
102 template<
typename Dst,
typename Src>
105 using Converter = boost::numeric::converter<Dst, Src>;
106 return Converter::out_of_range(v) == boost::numeric::cInRange;
110 #endif // QI_NUMERIC_HPP
Dst numericConvertBound(Src v)
Dst numericConvert(Src v)
bool numericIsInRange(Src v)
boost::numeric::positive_overflow NumericPositiveOverflow
#define QI_ASSERT_UNREACHABLE()
boost::numeric::negative_overflow NumericNegativeOverflow