xte::big_int<T>::operator-()

Defined in header <xte/math/big_int.hpp>


Definitions

#0
[[nodiscard]] constexpr xte::big_int<T> operator-() const & noexcept(false);
Returns another big-integer with the same magnitude but opposite sign. May throw if allocation fails.

#1
[[nodiscard]] constexpr xte::big_int<T>&& operator-() && noexcept;
Returns another big-integer with the same magnitude but opposite sign. The old object is destructively moved-from.

#2
[[nodiscard]] friend constexpr xte::big_int<T> operator-(xte::big_int<T> lhs, const xte::big_int<T>& rhs) noexcept(false);
Computes the difference of two big-integers. May throw if allocation fails.

#3
[[nodiscard]] friend constexpr xte::big_int<T> operator-(xte::big_int<T> lhs, xte::big_int<T>&& rhs) noexcept(false);
Computes the difference of two big-integers. lhs is destructively moved-from. May throw if allocation fails.



Example

constexpr auto i64_max = 9223372036854775807;
constexpr auto i64_min = -i64_max - 1;
static_assert(-(xte::big_int(i64_min) - i64_max) == 18446744073709551615ull);
[View in Compiler Explorer]