mp_units::utility::safe_int::safe_int

Constructs a safe_int<T, ErrorPolicy> from a safe_int wrapping a different integral type, checking for overflow.

Synopsis

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

template</* implementation-defined */ U>
[[nodiscard]]
constexpr
explicit(!detail::is_value_preserving_int_v<U, T>)
safe_int(safe_int<U, ErrorPolicy> other);

Return Value

NOTE

The return value should not be discarded.

Parameters

NameDescription
otherthe safe_int to convert from