Constructors
Declared in <mp-units/utility/safe_int.h>
Default-constructs a safe_int holding a value-initialized T.
[[nodiscard]]
safe_int() = default;
» more...
Constructs a safe_int<T, ErrorPolicy> from a safe_int wrapping a different integral type, checking for overflow.
template</* implementation-defined */ U>
[[nodiscard]]
constexpr
explicit(!detail::is_value_preserving_int_v<U, T>)
safe_int(safe_int<U, ErrorPolicy> other);
» more...
Constructs a safe_int from a non-floating-point value, checking for overflow.
template<typename U>
requires (!treat_as_floating_point<std::remove_cvref_t<U>>) && std::is_constructible_v<T, U>
[[nodiscard]]
constexpr
explicit(!detail::is_value_preserving_v<std::remove_cvref_t<U>, T> || !std::convertible_to<U, T>)
safe_int(U const& v);
» more...
The return value should not be discarded.
| Name | Description |
|---|---|
| other | the safe_int to convert from |
| v | the value to convert from |