Home | History | Annotate | Download | only in numerics

Lines Matching defs:Dst

53 template <typename Dst, typename Src>
55 return internal::DstRangeRelationToSrcRange<Dst>(value).IsValid();
74 template <typename Dst, class CheckHandler = CheckOnFailure, typename Src>
75 constexpr Dst checked_cast(Src value) {
79 return IsValueInRangeForNumericType<Dst, SrcType>(value)
80 ? static_cast<Dst>(static_cast<SrcType>(value))
81 : CheckHandler::template HandleFailure<Dst>();
108 template <typename Dst, template <typename> class S, typename Src>
109 constexpr Dst saturated_cast_impl(Src value, RangeCheck constraint) {
113 ? (!constraint.IsUnderflowFlagSet() ? static_cast<Dst>(value)
114 : S<Dst>::Underflow())
117 ? S<Dst>::Overflow()
118 : S<Dst>::NaN());
125 template <typename Dst,
129 constexpr Dst saturated_cast(Src value) {
131 return saturated_cast_impl<Dst, SaturationHandler, SrcType>(
133 DstRangeRelationToSrcRange<Dst, SaturationHandler, SrcType>(value));
139 template <typename Dst, typename Src>
140 constexpr Dst strict_cast(Src value) {
143 static_assert(std::is_arithmetic<Dst>::value, "Result must be numeric.");
151 static_assert(StaticDstRangeRelationToSrcRange<Dst, SrcType>::value ==
156 return static_cast<Dst>(static_cast<SrcType>(value));
160 template <typename Dst, typename Src, class Enable = void>
165 template <typename Dst, typename Src>
167 Dst,
169 typename std::enable_if<ArithmeticOrUnderlyingEnum<Dst>::value &&
171 static const bool value = StaticDstRangeRelationToSrcRange<Dst, Src>::value ==
209 // the member value functions (e.g. val.template ValueOrDie<Dst>()), use one
210 // of the value helper functions (e.g. ValueOrDieForType<Dst>(val)).
215 template <typename Dst,
217 IsNumericRangeContained<Dst, T>::value>::type* = nullptr>
218 constexpr operator Dst() const {
219 return static_cast<typename ArithmeticOrUnderlyingEnum<Dst>::type>(value_);