mp_units::utility::detail::is_value_preserving_int_v

Synopsis

Declared in <mp-units/utility/safe_int.h>

template<
    typename From,
    typename To>
inline constexpr bool is_value_preserving_int_v = [] {
  using from_raw_t = underlying_int_type_t<From>;
  using to_raw_t = underlying_int_type_t<To>;
  if constexpr (integral<from_raw_t> && integral<to_raw_t>)
    return int_in_range<to_raw_t>(std::numeric_limits<from_raw_t>::min()) &&
           int_in_range<to_raw_t>(std::numeric_limits<from_raw_t>::max());
  else
    return false;
}();