xieite::big_int {}

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

A class for storing and operating on very large integers.


Definition

template<std::unsigned_integral T = std::uint64_t>
struct big_int {
	using type = T;

	template<std::integral U = int>
	explicit(false) constexpr big_int(U = 0) noexcept;

	template<typename U>
	explicit constexpr big_int(const xieite::big_int<U>&) noexcept;

	template<xieite::is_input_range<[]<std::same_as<T>> {}> R>
	explicit constexpr big_int(R&&, bool = false) noexcept;

	explicit constexpr big_int(std::string_view, xieite::ssize_t = 10, xieite::num_str_config = {}) noexcept;

	template<std::integral U>
	explicit constexpr operator U() const noexcept;

	explicit(false) constexpr operator bool() const noexcept;

	friend constexpr std::strong_ordering operator<=>(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr std::strong_ordering operator<=>(const xieite::big_int<T>&, U) noexcept;

	friend constexpr bool operator==(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr bool operator==(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T> operator+() const noexcept;

	friend constexpr xieite::big_int<T> operator+(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator+(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator+=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator+=(U) noexcept;

	constexpr xieite::big_int<T>& operator++() noexcept;

	constexpr xieite::big_int<T>& operator++(int) noexcept;

	constexpr xieite::big_int<T> operator-() const noexcept;

	friend constexpr xieite::big_int<T> operator-(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator-(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator-=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator-=(U) noexcept;

	constexpr xieite::big_int<T>& operator--() noexcept;

	constexpr xieite::big_int<T>& operator--(int) noexcept;

	friend constexpr xieite::big_int<T> operator*(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator*(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator*=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator*=(U) noexcept;

	friend constexpr xieite::big_int<T> operator/(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator/(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator/=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator/=(U) noexcept;

	friend constexpr xieite::big_int<T> operator%(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator%(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator%=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator%=(U) noexcept;

	constexpr xieite::big_int<T> operator~() const noexcept;

	friend constexpr xieite::big_int<T> operator&(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator&(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator&=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator&=(U) noexcept;

	friend constexpr xieite::big_int<T> operator|(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator|(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator|=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator|=(U) noexcept;

	friend constexpr xieite::big_int<T> operator^(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator^(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator^=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator^=(U) noexcept;

	friend constexpr xieite::big_int<T> operator<<(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator<<(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator<<=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator<<=(U) noexcept;

	friend constexpr xieite::big_int<T> operator>>(const xieite::big_int<T>&, const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	friend constexpr xieite::big_int<T> operator>>(const xieite::big_int<T>&, U) noexcept;

	constexpr xieite::big_int<T>& operator>>=(const xieite::big_int<T>&) noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T>& operator>>=(U) noexcept;

	constexpr xieite::big_int<T> abs() const noexcept;

	constexpr xieite::big_int<T> pow(xieite::big_int<T>) const noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T> pow(U) const noexcept;

	constexpr xieite::big_int<T> root(const xieite::big_int<T>&) const noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T> root(U) const noexcept;

	constexpr xieite::big_int<T> log(const xieite::big_int<T>&) const noexcept;

	template<std::integral U>
	constexpr xieite::big_int<T> log(U) const noexcept;

	constexpr xieite::big_int<T> str(xieite::ssize_t = 10, xieite::num_str_config = {}) const noexcept;
};


Example

int main() {
	xieite::dump(xieite::big_int(99).pow(99).str());
}
Output:
369729637649726772657187905628805440595668764281741102430259972423552570455277523421410650010128232727940978889548326540119429996769494359451621570193644014418071060667659301384999779999159200499899
[View in Compiler Explorer]